iPhone编程中的UIButton问题

时间:2010-03-11 10:20:24

标签: iphone uibutton

你能给我一些链接或示例程序来在视图上创建UIButton并对其进行操作,我们需要在其他视图上再创建一个按钮。 请帮忙

1 个答案:

答案 0 :(得分:4)

-(void)action:(id)sender
{

}


UIButton *button = [UIButton buttonWithType: UIButtonTypeRoundedRect];  
button.frame = CGRectMake(x, y, width, height);
button.titleLabel.font = [UIFont systemFontOfSize: 30];

[button setTitle:@"TITLE"
        forState:UIControlStateNormal];

[button addTarget:self
        action:@selector(action:) 
        forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button];