我的新目標C.我有以下代碼:目標C - 按鈕
UIButton *loginButton = [[UIButton alloc] initWithFrame:CGRectMake(25, self.view.bounds.size.height-60, 230, 45)];
loginButton.backgroundColor =UIColorFromAltRGB(0xa40002);//RGB4(0xa40002);
loginButton.layer.cornerRadius = 5.0f;
loginButton.titleLabel.font = [UIFont fontWithName:boldFontName size:14.0f];
[loginButton setTitle:@"CREATE" forState:UIControlStateNormal];
[loginButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[loginButton setTitleColor:[UIColor colorWithWhite:1.0f alpha:0.5f] forState:UIControlStateHighlighted];
[loginButton addTarget:self action:@selector(createUser) forControlEvents:UIControlEventTouchDown];
[self.view addSubview:loginButton];
白衣:
-(void)createUser
{
NSLog(@"create");
(....)
}
但它從來沒有顯示/記錄。不要輸入createuser。
LE:
,如果我把
NSLog(@"he did load : %@",self.delegate);
它讓我看到第一個畫面。它假設給我看當前的視圖控制器?
LE:
我通過設定解決問題:
self.delegate = self
不知道爲什麼現在的工作...但它的確定...不是我的代碼 感謝所有幫助
將「UIControlEventTouchDown」替換爲「UIControlEventTouchUpInside」 –
nope。仍然不工作 – Corneliu
您的代碼在我的演示jst中工作從「-createUser」方法中刪除(....) –