Hi,
I'm using this code I wrote to create unbutton and assign it to rightBarButtonItem:
what happens is that on the right side of the rightBarButtonItem there is space
and I don't know what is the problem.
Maybe changing the rightBarButtonItem frame to the UIButton frame will solve the problem?
EDIT:
I added the button as button and not as BarButton.
But I don't think this is the ideal solution.
Thanks!
I'm using this code I wrote to create unbutton and assign it to rightBarButtonItem:
PHP:
UIButton *rightButton2 = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage* rightImage1 = [[UIImage imageNamed:@"DropDownMenu.png"] stretchableImageWithLeftCapWidth:10 topCapHeight:10];
[rightButton2 setBackgroundImage:rightImage1 forState:UIControlStateNormal];
[rightButton2 setBackgroundImage:rightImage1 forState:UIControlStateDisabled];
rightImage1 = [[UIImage imageNamed:@"DropDownMenuPressed.png"] stretchableImageWithLeftCapWidth:10 topCapHeight:10];
[rightButton2 setBackgroundImage:rightImage1 forState:UIControlStateHighlighted];
[rightButton2 addTarget:self action:@selector(popUpBlackMenu) forControlEvents:UIControlEventTouchUpInside];
rightButton2.frame = CGRectMake(0, 0, 59, 48);
UIBarButtonItem *plusButton2 = [[[UIBarButtonItem alloc] initWithCustomView:rightButton2] autorelease];
uperBar.rightBarButtonItem = plusButton2;
what happens is that on the right side of the rightBarButtonItem there is space

and I don't know what is the problem.
Maybe changing the rightBarButtonItem frame to the UIButton frame will solve the problem?
EDIT:
I added the button as button and not as BarButton.
PHP:
rightButton2.frame = CGRectMake(261, -4, 59, 48);
[naccontroller.view addSubview:rightButton2];
But I don't think this is the ideal solution.
Thanks!
Last edited: