3
我正在尝试滑动菜单。唯一的问题是UIButton的图像在运行时不显示。这是我写的代码。UIButton图像不显示在导航栏中
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(NSString *)segueIdentifierForIndexPathInLeftMenu:(NSIndexPath *)indexPath
{
NSString *identifier;
switch (indexPath.row) {
case 0:
[email protected]"firstSegue";
break;
case 1:
[email protected]"secondSegue";
break;
}
return identifier;
}
-(void)configureLeftMenuButton:(UIButton *)button
{
CGRect frame = button.frame;
frame.origin=(CGPoint){0.0};
frame.size = (CGSize){40.40};
button.frame = frame;
[button setImage:[UIImage imageNamed:@"icon-menu"] forState:UIControlStateNormal];
}
此代码是不够的..您是否已将按钮添加到视图? –
不,我没有向故事板添加按钮。我做了实验,但仍然无法显示! – user2167323
刚刚完成。 – user2167323