如何自定義UIButton,以便它將顯示除默認按鈕樣式之外的其他東西。iphone定製UIButtons
0
A
回答
0
在界面構建中,只需將類型從圓角矩形更改爲自定義,然後指定新的背景圖像。
在代碼:
UIButton* b = [UIButton buttonWithType:UIButtonTypeCustom];
0
UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
0
設置在界面生成器在其上的背景圖像,設定類型=定製。
0
@shabbir 1日選擇按鈕,然後按CMD + 1的變化按鈕類型定製 如果是正確的選擇我的答案 其他方式是
UIButton* b = [UIButton buttonWithType:UIButtonTypeCustom];
如果你想打電話按鈕圖像,然後使用這個
UIButton *button = [[UIButton alloc]initWithImage:[UIImage imageNamed:@"button.png"]];
[button release];
0
你的意思是顯示按鈕與自定義圖像?你可以試試這個:
UIButton *button = [[UIButton alloc]initWithImage:[UIImage imageNamed:@"button.png"]];
[button release];
1
你可以做這樣的事情:
UIImage *btnImage = [UIImage imageNamed:@"images-01.png"];
UIButton *btnGo = [UIButton buttonWithType:UIButtonTypeCustom];
btnGo.frame = CGRectMake(85,123, 100, 26);
btnGo.backgroundcolor = [UIColor clearColor];
btnGo. setImage:btnImage forState: UIcontrolStateNormal];
[btnGo.titleLabel setFont: [UIFont systemFontOfSize:14]];
btnGo addTarget: self action:@selector(btnGoClicked) forControlEvents: UIControlEventTouchUpInside];
2
UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(10.0, 20.0, 50.0, 50.0); // You can change the x, y, width, height.
[btn setImage:[UIImage imageNamed:@"img.png"] forState:UIControlStateNormal];
[self.view addSubView:btn];
0
UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
button.frame = urRequiredFrame;
[button setImage:yourCustomImage forState:UIControlStateNormal];
button addTarget:self action:@selector(buttonPressed:) forControlEvents: UIControlEventTouchUpInside];
[self.view addSubView:button];
1
您可以使用此
UIButton *customButton = [UIButton buttonWithType:UIButtonTypeCustom];
customButton.frame = CGRectMake(899, 5, 82, 55);
customButton.tag = 123;
[customButton addTarget:self action:@selector(buttonToggleForHide) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:customButton];
,使事件,使用
-(void)buttonToggleForHide{...}
相關問題
- 1. 自定義UIButtons
- 2. 只有一些UIButtons與定製工作
- 3. 定製UIButtons的有效方法
- 4. 用UIButtons複製UISegmentedControl - 我
- 5. 使用UIButtons自定義TabBar
- 6. 定製quicktime iphone
- 7. 定製uiwindow iphone
- 8. 定製iPhone鍵盤
- 9. iPhone定製地圖
- 10. 爲iPhone定製iCarousel?
- 11. 定製Iphone鍵盤
- 12. iPhone的定製UISlider
- 13. Monotouch iphone定製UITableView
- 14. 複製UIView,在其中的UIButtons
- 15. 通過UIButtons的Tabbar控制器?
- 16. 由多個UIButtons控制的多個UIImageView
- 17. 組UIButtons以限制「選中」狀態
- 18. 如何在iPhone相機中使用UIButtons和UIImagePickerCameraControl自定義ZoomIn和ZoomOut功能?
- 19. 請一定UIButtons消失使用UISegmentedControl
- 20. 在UIScrollView中重新定位UIButtons
- 21. 縮放後重新定位UIButtons
- 22. 動畫UIButtons
- 23. 處理UIButtons iOS
- 24. 一拖二UIButtons
- 25. UICollectionView或者UIButtons
- 26. 子類UIButtons
- 27. MVC和UIButtons
- 28. 拖拽UIButtons
- 29. 所有UIButtons
- 30. 隱藏UIButtons
@ shabbir-ahmed - 請標記正確的答案。它激勵用戶回答更多。此外,它可以幫助用戶決定他們應該積極回答您的問題。 – iMatoria 2011-05-13 05:39:15