Incorrect vertical position for UIBarButtonItems in UIToolbar for iOS 7 , 位置有誤

February 7, 2014   ·   0 Comments

Screen Shot 2014-02-07 at 12.53.20 PM

UIToolbar* tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 75, 44)];

NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:2];

UIBarButtonItem *composeButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(toggleDelete:)];

[buttons addObject:composeButton];

UIBarButtonItem *fixedSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];

fixedSpace.width = 5;

[buttons addObject:fixedSpace];

UIBarButtonItem* bi = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(touchMe:)];

[buttons addObject:bi];

[tools setItems:buttons animated:NO];

tools.barStyle = -1;

//self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:tools];

[self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:deleteButton, bi, nil]];

[bi release];
[fixedSpace release];
[composeButton release];
[buttons release];    
[tools release];

shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter


Readers Comments (0)

You must be logged in to post a comment.

PowenKo’s Online Store

iOS Tutorial9



Recent Posts