`
feipigwang
  • 浏览: 746798 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

Custom UIButton

 
阅读更多

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

    CustomUIButton

    自定义UIButton效果

    该源码是一个来自网络的自定义UIButton效果案例,源码ZFRippleButton,用Swift实现的iOS自定义UIButton效果,灵感来自于Google Material Design。...Custom UIButton effect inspired by Google Material Design

    CKCountdownButton:在 UIButton 上显示倒数计时器

    CK倒计时按钮 特征 计数时按钮被禁用 倒计时时按钮自动启用 ... 将 UIButton 的类型更改为Custom ,否则它会在倒计时时闪烁。 在用户定义的运行时属性窗口中设置count 。 如果您想在用户单击按钮时开

    ios-Custom Segment Button.zip

    通过UIButton和UIScrollView自定义SegmentController

    Custom Button Title不在背景图

    UIButtonTypeCustom类型的按钮,背景为图片,标题文字不在背景图上,是可变的,并且标题也有按下的效果。

    Swift-UIKit-Extensions:Swift中UIKit的扩展

    Custom ) as UIButton !button. enable ()button. disable ()// UIColorlet darkOrange = UIColor ( hex : 0xFF8C00 )// Web ColorsUIColor (). PinkWebColor ()// UIViewlet title = UILabel

    UIBarButton+Badge

    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 ...

    Navigation bar的注意事项详解

    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:Xamarin.iOS与AgileBits 1Password应用程序扩展库的绑定

    onepassword-app-extension-xamarin ... var passwordFillButton = new UIButton ( UIButtonType . Custom ) { AccessibilityLabel = " Fill Password " , ContentMode = UIViewContentMode . Left , C

    SwiftCustomInputView:swift4.0,弹出键盘,输入文字,评论功能的封装

    SwiftCustomInputView swift4.0,弹出键盘,输入文字...@IBAction func inputButtonAction(_ sender: UIButton) { let view = CustomInputView.instance(superView: self.view) view?.delegate = self } 效果截图:

    LearnSwift引导页

    作者fengzhihao123,源码LearnSwift,这是swift自学之路的一个小案例。 1、UIlabel 普通的label (normal label) 带有阴影的label (shadow label) 多属性文本的label ...自定义button(custom button)

    IOS5 Programming Cookbook

    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...

    Unity.in.Action.Multiplatform.Game.Development.in.Csharp

    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 ...

Global site tag (gtag.js) - Google Analytics