0
我嘗試使用以下設置Rounded按鈕,但它從視圖中消失。如果我刪除了以編程方式設置RoundedRect按鈕
takebtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
然後它顯示矩形按鈕。幫助我獲得RoundedRect按鈕。
takebtn = [[UIButton alloc]initWithFrame:CGRectMake(30, 325, 250, 40)];
takebtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[takebtn setTitle:@"Take Photo" forState:UIControlStateNormal];
takebtn.backgroundColor=[UIColor colorWithRed:50.0/255.0 green:205.0/255.0 blue:50.0/255.0 alpha:1.0];
[takebtn addTarget:self
action:@selector(takePhoto:)
forControlEvents:(UIControlEvents)UIControlEventTouchDown];
[nextview addSubview:takebtn];
+1考慮到給出的代碼,這是更好的答案,因爲OP代碼清楚地表明第1和第2行泄漏。 –