Saturday, January 11, 2014

ios7 radio button

For example, the round button, ios7 are used in several places, how to do? Whether the system provides a default style, word on the class can do. For example:
UIButton * btn1 = [UIButton buttonWithType: UIButtonTypeSystem];
Seeking advice, thank you

Reply:
You make it a UI prototype picture on it.

UIButton * btn = [UIButton buttonWithType: UIButtonTypeRoundedRect];
UIImage * bgimg = [UIImage imageNamed: @ "bgimg"];
btn.frame = CGRectMake (30, (0,0, bgimg.size.width, bgimg.size.height);
[Btn setBackgroundImage: bgimg forState: UIControlStateNormal];
[Btn addTarget: self action: @ selector (tagrt :) forControlEvents: UIControlEventTouchUpInside];
[Self.view addSubview: btn];
Reply:
You can customize a CircleButton it directly or indirectly inherits from UIButton
In this custom class, override the - (void) drawRect: (CGRect) rect or awakeFromNib to handle also.
Reply:
cited a floor JoesenZhao reply:
you let UI was a prototype picture on it.

UIButton * btn = [UIButton buttonWithType: UIButtonTypeRoundedRect];
UIImage * bgimg = [UIImage imageNamed: @ "bgimg"];
btn.frame = CGRectMake (30, (0,0, bgimg.size.width, bgimg.size.height);
[Btn setBackgroundImage: bgimg forState: UIControlStateNormal];
[Btn addTarget: self action: @ selector (tagrt :) forControlEvents: UIControlEventTouchUpInside];
[Self.view addSubview: btn];


I just to ask, is there a system like the style, if the system does not provide further customization.
Reply:
reference to the second floor zhanglei5415 reply:
can customize a CircleButton it directly or indirectly inherits from UIButton
In this custom class, override the - (void) drawRect: (CGRect) rect or awakeFromNib to handle also.


That was to be their own definition, I think the system will provide the style and the like.
Reply:
cited a floor JoesenZhao reply:
you let UI was a prototype picture on it.

UIButton * btn = [UIButton buttonWithType: UIButtonTypeRoundedRect];
UIImage * bgimg = [UIImage imageNamed: @ "bgimg"];
btn.frame = CGRectMake (30, (0,0, bgimg.size.width, bgimg.size.height);
[Btn setBackgroundImage: bgimg forState: UIControlStateNormal];
[Btn addTarget: self action: @ selector (tagrt :) forControlEvents: UIControlEventTouchUpInside];
[Self.view addSubview: btn];


In fact, not pictures, just myself crunching out.

 
UIButton * btn1 = [UIButton buttonWithType: UIButtonTypeRoundedRect];
btn1.frame = CGRectMake (150, 350, 60, 60);

[Btn1 setTitle: @ "Start" forState: UIControlStateNormal];
btn1.layer.borderWidth = 1;
btn1.layer.borderColor = [UIColor greenColor] CGColor;.
btn1.layer.cornerRadius = 30;
btn1.layer.masksToBounds = YES;
[Btn1 setTitleColor: [UIColor greenColor] forState: UIControlStateNormal];
[Self.view addSubview: btn1];


Reply:
references, 4th Floor u010232872 reply:
Quote: references to the second floor zhanglei5415 reply:

You can customize a CircleButton it directly or indirectly inherits from UIButton
In this custom class, override the - (void) drawRect: (CGRect) rect or awakeFromNib to handle also.


That was to be their own definition, I think the system will provide the style and the like.


Reusable. Proposal package it.
Reply:
reference to the 6th floor zhanglei5415 reply:
Quote: references to the 4th floor u010232872 reply:

Quote: references to the second floor zhanglei5415 reply:

You can customize a CircleButton it directly or indirectly inherits from UIButton
In this custom class, override the - (void) drawRect: (CGRect) rect or awakeFromNib to handle also.


That was to be their own definition, I think the system will provide the style and the like.


Reusable. Proposal package it.


Closure

No comments:

Post a Comment