自定义视图与选择器视图上的按钮

时间:2012-03-05 20:54:55

标签: iphone

尝试使用按钮而不是pickerview创建自定义视图。我遇到的问题是自定义视图正在显示而不是按钮

UIView *view=[[[UIView alloc]initWithFrame:CGRectMake(0,200,320,300)]autorelease];

view.backgroundColor=[UIColor grayColor];

UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom];

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

myButton.frame = CGRectMake(50, 300, 60, 50);

[myButton.layer setMasksToBounds:YES];

[myButton.layer setCornerRadius:10.0f];

[myButton setTitle:@"English" forState:UIControlStateNormal];

myButton.backgroundColor = [UIColor whiteColor];

[self.view addSubview:view];

[self.view addSubview:myButton];

知道我在这里缺少什么。

0 个答案:

没有答案
相关问题