toolbar button image

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • toolbar button image

    Hallo Community,

    ich möchte ein Bild für ein toolbarbutton einbinden.
    ich bekomme immer einen Fehler, weiß jemand weiter?

    mein ursprungscode:

    Quellcode

    1. UIToolbar* tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 158, 44.02)];//44.02
    2. NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:2];
    3. UIBarButtonItem *micButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Mic", nil)
    4. style:UIBarButtonItemStyleBordered
    5. target:self
    6. action:@selector(onClickMic:)];
    7. [buttons addObject:micButton];
    8. UIBarButtonItem *setButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"settings", nil)
    9. style:UIBarButtonItemStyleBordered
    10. target:self
    11. action:@selector(onClickSettings:)];
    12. [buttons addObject:setButton];
    13. [tools setItems:buttons animated:YES];
    14. [buttons release];
    15. self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:tools];
    16. [tools release];
    Alles anzeigen



    gruß
    lernen, lernen, lernen :)
  • versuche ich es mit initWithImage... zu machen gibt er mir diese fehlermeldung
    +

    Quellcode

    1. 2011-09-30 14:26:18.115 SMSplus0.9.9[1111:707] -[NSCFString size]: unrecognized selector sent to instance 0x97614
    2. 2011-09-30 14:26:18.164 SMSplus0.9.9[1111:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString size]: unrecognized selector sent to instance 0x97614'
    3. *** Call stack at first throw:
    4. (
    5. 0 CoreFoundation 0x33fb764f __exceptionPreprocess + 114
    6. 1 libobjc.A.dylib 0x31134c5d objc_exception_throw + 24
    7. 2 CoreFoundation 0x33fbb1bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
    8. 3 CoreFoundation 0x33fba649 ___forwarding___ + 508
    9. 4 CoreFoundation 0x33fba748 __forwarding_prep_1___ + 56
    10. 5 UIKit 0x3268abf5 -[UIToolbarButton initWithImage:selectedImage:highlightImage:label:labelHeight:withBarStyle:withStyle:withInsets:possibleTitles:withTintColor:bezel:imageInsets:glowInsets:imageIsBackground:] + 156
    11. 6 UIKit 0x3268ab4b -[UIToolbarButton initWithImage:selectedImage:label:labelHeight:withBarStyle:withStyle:withInsets:possibleTitles:withTintColor:bezel:imageInsets:glowInsets:] + 110
    12. 7 UIKit 0x326a4797 -[UIBarButtonItem(UIBarButtonItemPrivate) createViewForToolbar:] + 1162
    13. 8 UIKit 0x326a2215 -[UIToolbar setItems:animated:] + 420
    14. 9 SMSplus0.9.9 0x000131d1 -[RootViewController repositionLayout:] + 7188
    15. 10 SMSplus0.9.9 0x00011517 -[RootViewController shouldAutorotateToInterfaceOrientation:] + 38
    16. 11 UIKit 0x3264bead -[UIViewController _isSupportedInterfaceOrientation:] + 48
    17. 12 UIKit 0x3264be6f -[UINavigationController _doesTopViewControllerSupportInterfaceOrientation:] + 46
    18. 13 UIKit 0x3264be37 -[UINavigationController shouldAutorotateToInterfaceOrientation:] + 14
    19. 14 UIKit 0x3264bdbf -[UINavigationController _isSupportedInterfaceOrientation:] + 54
    20. 15 UIKit 0x3264bd71 -[UIViewController setInterfaceOrientation:] + 24
    21. 16 UIKit 0x3264a5bd -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:] + 376
    22. 17 UIKit 0x3264a3e5 -[UINavigationController viewDidMoveToWindow:shouldAppearOrDisappear:] + 36
    23. 18 UIKit 0x326295a7 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 506
    24. 19 UIKit 0x3262932f -[UIView(Hierarchy) _postMovedFromSuperview:] + 106
    25. 20 UIKit 0x3260ec1b -[UIView(Internal) _addSubview:positioned:relativeTo:] + 678
    26. 21 UIKit 0x3260e96b -[UIView(Hierarchy) addSubview:] + 22
    27. 22 SMSplus0.9.9 0x00002cfd -[SMSOptiAppDelegate applicationDidFinishLaunching:] + 3072
    28. 23 UIKit 0x3263e85d -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 832
    29. 24 UIKit 0x32638b65 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 272
    30. 25 UIKit 0x3260d7d7 -[UIApplication handleEvent:withNewEvent:] + 1114
    31. 26 UIKit 0x3260d215 -[UIApplication sendEvent:] + 44
    32. 27 UIKit 0x3260cc53 _UIApplicationHandleEvent + 5090
    33. 28 GraphicsServices 0x31c4ce77 PurpleEventCallback + 666
    34. 29 CoreFoundation 0x33f8ea97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
    35. 30 CoreFoundation 0x33f9083f __CFRunLoopDoSource1 + 166
    36. 31 CoreFoundation 0x33f9160d __CFRunLoopRun + 520
    37. 32 CoreFoundation 0x33f21ec3 CFRunLoopRunSpecific + 230
    38. 33 CoreFoundation 0x33f21dcb CFRunLoopRunInMode + 58
    39. 34 UIKit 0x32637d49 -[UIApplication _run] + 372
    40. 35 UIKit 0x32635807 UIApplicationMain + 670
    41. 36 SMSplus0.9.9 0x00002079 main + 60
    42. 37 SMSplus0.9.9 0x00002038 start + 40
    43. )
    Alles anzeigen
    lernen, lernen, lernen :)