小编Lin*_*ink的帖子

UIButton setTitle forState Not Working

当我从上一个视图中按下"下一步"按钮时,我正在尝试在新视图上设置UIButton的文本.我已正确设置了IBOutlet,我已经全神贯注地寻找答案,但它根本不起作用.

以下是我正在尝试做的一个示例:

- (IBAction)computeQuiz:(id)sender
{  
    [fiveFootUniversalResults setTitle:@"Test" forState:UIControlStateNormal];
}

- (IBAction)jumpT10ResultsView:(id)sender
{       
    NSString *nibFileToLoad = @"JumpT10Results";

    UIDevice *device = [UIDevice currentDevice];

    if([device userInterfaceIdiom] == UIUserInterfaceIdiomPad)
    {
        nibFileToLoad = [nibFileToLoad stringByAppendingString:@"-iPad"];
    }

    JumpmasterPathfinderViewController *nextView = [[JumpmasterPathfinderViewController    alloc] initWithNibName:nibFileToLoad bundle:nil];

    // Modal view controller
    nextView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController:nextView animated:YES];

    [nextView release];

    [scrollView setContentSize:CGSizeMake(imageViewWidth, imageViewHeight + 44.0)];
}
Run Code Online (Sandbox Code Playgroud)

这些操作都连接到上一个视图上的按钮.视图加载精细和一切,唯一的问题是文本不会在按钮上更改.我100%肯定我的IBOutlets设置正确我只是不知道我做错了什么.有任何想法吗?

iphone uibutton settext xcode4

18
推荐指数
1
解决办法
2万
查看次数

标签 统计

iphone ×1

settext ×1

uibutton ×1

xcode4 ×1