Ios 如何设置UIBarbuttonims的位置和大小
我知道这类问题被问了很多,但我仍然找不到一个简单的方法来实施它。 现在这就是我所拥有的Ios 如何设置UIBarbuttonims的位置和大小,ios,objective-c,uinavigationbar,uinavigationitem,Ios,Objective C,Uinavigationbar,Uinavigationitem,我知道这类问题被问了很多,但我仍然找不到一个简单的方法来实施它。 现在这就是我所拥有的 [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"NavigationBackground.png"] forBarMetrics:UIBarMetricsDefault]; CGRect ButtonSizeframe = CGRectMake(0, 0,50,50); //M
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"NavigationBackground.png"] forBarMetrics:UIBarMetricsDefault];
CGRect ButtonSizeframe = CGRectMake(0, 0,50,50);
//Msg Navigator Button
UIButton *tmpButtonMsg = [UIButton buttonWithType:UIButtonTypeCustom];
[tmpButtonMsg setImage:[UIImage imageNamed:@"msg.png"] forState:UIControlStateNormal];
[tmpButtonMsg setImage:[UIImage imageNamed:@"msgPressed.png"] forState:UIControlStateHighlighted];
tmpButtonMsg.frame = ButtonSizeframe;
[tmpButtonMsg setTag:MsgBox];
[tmpButtonMsg addTarget:self action:@selector(ButtonNavigationAction:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *msgButton = [[UIBarButtonItem alloc] initWithCustomView:tmpButtonMsg];
//Tag Navigator Button
UIButton *tmpButtonTag = [UIButton buttonWithType:UIButtonTypeCustom];
[tmpButtonTag setImage:[UIImage imageNamed:@"UserTagIcon.png"] forState:UIControlStateNormal];
tmpButtonTag.frame = ButtonSizeframe;
[tmpButtonTag setTag:Tag];
[tmpButtonTag addTarget:self action:@selector(ButtonNavigationAction:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *tagButton = [[UIBarButtonItem alloc] initWithCustomView:tmpButtonTag];
NSArray *myArray = [[NSArray alloc] initWithObjects:msgButton,tagButton,nil];
[self.navigationItem setRightBarButtonItems:myArray animated:YES];
我希望两个按钮都是正方形(带有工具栏高度),它们之间没有空格,并向右对齐。
我想我读了stack上的所有问题(我试过了,但没有找到一个简单的方法,我在这里错过了什么?(为什么苹果会做如此明显的事情如此不方便,或者像往常一样是我的错?)