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