0
CGRect frame = CGRectMake(10.0, 30.0, 32.0, 29.0);
UIImage *buttonImage = [UIImage imageNamed:@"visit_icon.png"];
UIButton *stopButton = [[UIButton alloc] initWithFrame:frame];
[stopButton setTitle:@"Button" forState:UIControlStateNormal];
[stopButton setTitleColor:[UIColor blackColor] forState:UIControlEventTouchDown];
[stopButton setBackgroundImage:buttonImage forState:UIControlStateNormal];
stopButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
stopButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
[stopButton addTarget:self action:@selector(stopAction:) forControlEvents:UIControlEventTouchUpInside];
我正在添加按鈕到我的根視圖控制器不工作 可能我需要添加這個作爲我的觀點的子視圖 我該怎麼做?以編程方式添加按鈕在導航根視圖中不起作用爲什麼?
是的,但我怎麼能在底部標籤欄 – 2010-07-11 11:57:05
添加按鈕,我怎樣才能把我的主視圖中的圖像添加作爲以前的子視圖... – 2010-07-11 16:38:10
'[stopButton removeFromSuperview];' – 2010-07-11 22:41:49