[Code Note] iOS-long blue button, ios-long blue button
I ,.
Ii. Code.
ViewController. m
-(Void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. // Add the device UIButton * deviceButton = [UIButton buttonWithType: UIButtonTypeRoundedRect]; deviceButton. frame = CGRectMake (self. view. frame. size. width-320)/2,100,320, 38); [deviceButton setTitle: @ "add device" forState: UIControlStateNormal]; deviceButton. backgroundColor = [UIColor colorwithred: 59/255. 0 green: 89/255. 0 blue: 152/255. 0 alpha: 1.0]; deviceButton. titleLabel. textColor = [UIColor whiteColor]; [deviceButton setTintColor: [UIColor whiteColor]; [deviceButton addTarget: self action: @ selector (doClickDeviceButton :) forControlEvents: Custom]; [self. view addSubview: deviceButton] ;}# pragma-mark-doClickActions // Add a device-(void) doClickDeviceButton :( UIButton *) btn {NSLog (@ "--- doClickDeviceButton ----");}