UIButton *Btn;
CGRect frame;
Btn = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
//按钮的类型
[Btn setImage:[UIImage imageNamed:@“aaa.png”] forState:UIControlStateNormal];//设置按钮图片
Btn.tag = 10;//设置按钮的表示
frame.size.width = 59;//设置按钮的宽度
frame.size.height = 59;
//设置按钮的高度
frame.origin.x =150;
frame.origin.y =260;//设置按钮的位置
[Btn setFrame:frame];
[Btn setBackgroundColor:[UIColor clearColor]];
[Btn
addTarget:self action:@selector(btnPressed:)forControlEvents:UIControlEventTouchUpInside];
//按钮的单击事件
[self.view addSubview:Btn];
[Btn release];
-(void)btnPressed:(id)sender {//在这里实现按钮的单击事件}
分享到:
相关推荐
CustomUIButton
该源码是一个来自网络的自定义UIButton效果案例,源码ZFRippleButton,用Swift实现的iOS自定义UIButton效果,灵感来自于Google Material Design。...Custom UIButton effect inspired by Google Material Design
FSCustomButtonDemo 一个高度自定义UIButton控件,自定义按钮布局样式
CK倒计时按钮 特征 计数时按钮被禁用 倒计时时按钮自动启用 ... 将 UIButton 的类型更改为Custom ,否则它会在倒计时时闪烁。 在用户定义的运行时属性窗口中设置count 。 如果您想在用户单击按钮时开
通过UIButton和UIScrollView自定义SegmentController
UIButtonTypeCustom类型的按钮,背景为图片,标题文字不在背景图上,是可变的,并且标题也有按下的效果。
Custom ) as UIButton !button. enable ()button. disable ()// UIColorlet darkOrange = UIColor ( hex : 0xFF8C00 )// Web ColorsUIColor (). PinkWebColor ()// UIViewlet title = UILabel
Your BarButtonItem can be any custom view you wish for. The badge on top can display any number or string of any size or length. - Create a UIButton with a badge on top. Easily customizable. Your ...
Bar button item 使用 button 作为 custom view,初始...let leftButton = UIButton(frame: CGRect(x: 0, y: 0, width: 80, height: 44)) leftButton.setTitleColor(UIColor.green, for: .normal) leftButton.setTitleC
onepassword-app-extension-xamarin ... var passwordFillButton = new UIButton ( UIButtonType . Custom ) { AccessibilityLabel = " Fill Password " , ContentMode = UIViewContentMode . Left , C
SwiftCustomInputView swift4.0,弹出键盘,输入文字...@IBAction func inputButtonAction(_ sender: UIButton) { let view = CustomInputView.instance(superView: self.view) view?.delegate = self } 效果截图:
作者fengzhihao123,源码LearnSwift,这是swift自学之路的一个小案例。 1、UIlabel 普通的label (normal label) 带有阴影的label (shadow label) 多属性文本的label ...自定义button(custom button)
2.16 Adding Buttons to the User Interface with UIButton 214 2.17 Displaying Images with UIImageView 220 2.18 Creating Scrollable Content with UIScrollView 226 2.19 Loading Web Pages with UIWebView 231...
Programming a UIButton component using SendMessage 115 Calling LoadLevel from SceneController 117 5.6 Summary 118 6 Puttinga2DGUIina3Dgame 119 6.1 Before you start writing code... 121 Immediate mode ...