Add subView 后subView不显示也不出错,求解
我用navigationController从一个view跳到另外一个view
navigationController代码:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ _detailController = [[WBDetailContentController alloc]init]; [self.navigationController pushViewController:_detailController animated:YES]; [_detailController release];}
- (void)viewDidLoad{ [super viewDidLoad]; self.title = @"test"; UIView *v = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]autorelease];// UIView *v2 = [[[UIView alloc]initWithFrame:CGRectMake(1, 1, 10, 10)]autorelease]; self.view = v; self.view.autoresizesSubviews = YES; [v release]; _buttonForword = [[UIButton alloc]initWithFrame:CGRectMake(40, 150, 20, 10)]; _buttonComment = [[UIButton alloc]initWithFrame:CGRectMake(70, 150, 20, 10)]; _buttonMore = [[UIButton alloc]initWithFrame:CGRectMake(100, 150, 20, 10)]; _buttonMore.titleLabel.text = @"More"; _buttonComment.titleLabel.text = @"Comment"; _buttonForword.titleLabel.text = @"Forword"; [self.navigationController.view addSubview:_buttonForword]; [self.view addSubview:_buttonComment]; [self.view addSubview:_buttonForword]; [self.view addSubview:_buttonMore]; [_buttonForword release]; [_buttonComment release]; [_buttonMore release];}