代码如下:
CGRect frame = CGRectMake(0, 400, 72.0, 37.0);
UIButton *button = [UIButton buttonWithType: UIButtonTypeRoundedRect];
button.frame = frame;
[buttonsetTitle:@"按钮"forState: UIControlStateNormal];
button.backgroundColor = [UIColor clearColor];
button.tag = 2000;
[buttonaddTarget: self action: @selector(buttonClicked:) forControlEvents: UIControlEventTouchUpInside];
[self.view addSubview: button];
希望对你有帮助!
网友评论