Как реализовать кнопку с программным обеспечением backgroundimage в iphone
Я разрабатываю образы с помощью кнопки программно в iphone. теперь я хочу добавить кнопку backgroundimage для следующих и предыдущих кнопок. Я хочу добавить изображения для этих кнопок программно.
UIImage *buttonImage = [UIImage imageNamed:@"image.png"];
//create the button and assign the image
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:buttonImage forState:UIControlStateNormal];
//create a UIBarButtonItem with the button as a custom view
//UIBarButtonItem *customBarItem = [[UIBarButtonItem alloc] initWithCustomView:button];
[button addTarget:self action:@selector(clickActionItem:) forControlEvents:UIControlEventTouchUpInside];
удача
Ответ 3
используйте это для установки изображения в вашей кнопке