您好我有一個由UIButtons製成的彈出菜單,我需要在菜單的每個按鈕中的圖像。我需要爲每個單獨的按鈕顯示不同的圖像。總共有6個按鈕。菜單中的按鈕不同的圖像iOS
我怎樣才能做到這一點
- (NSInteger)makeOneButton:(NSString *)title action:(SEL)action top:(NSNumber *)top into:(UIView *)parent
{
// NOTE: if you want more stuff here, I'd put all of the items in a view (including this button)
UIButton * button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:title forState:UIControlStateNormal];
//[button setImage:[UIImage imageNamed:@"paper.png"] forState:UIControlStateNormal];
//UIButtonTypeCustom
[button addTarget:self action:action forControlEvents:UIControlEventTouchUpInside];
[button.titleLabel setFont:[UIFont boldSystemFontOfSize:7]];
[parent addSubview:button];
[button mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(top);
make.left.equalTo(parent.mas_left);
make.width.equalTo(parent);
make.height.equalTo([NSNumber numberWithInteger:mCurrentCellHeight]);
}];
return mCurrentCellHeight;
}
問題是......? – vikingosegundo 2014-09-20 02:21:29