在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
- (void)createButton { UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; myButton.frame = CGRectMake(100, 100, 100, 50); [myButton setTitle:@"click me!" forState:UIControlStateNormal]; SEL eventHandler = @selector(clickHandler); [myButton addTarget:self action:eventHandler forControlEvents:UIControlEventTouchUpInside]; [window addSubview:myButton]; } - (void)clickHandler { NSLog(@"You clicked button!"); } |
请发表评论