开发者

Can't update the UILabel from the controller...

开发者 https://www.devze.com 2023-01-14 09:50 出处:网络
I link the xib with the source code, but when I try to update the UILabel, it can\'t update with no error msg. So, I make a breakpoint. When I inspect to the UILabel, which is a 0x0.

I link the xib with the source code, but when I try to update the UILabel, it can't update with no error msg. So, I make a breakpoint. When I inspect to the UILabel, which is a 0x0.

I already made @sy开发者_开发技巧nthesize in .m, but I created the IBOutlet on the .h, also I did the IBOutlet UILabel *xxxLabel;

@property (retain, nonatomic) UILabel *xxxLabel;

already.

I can display the Nib and the default value that I set on the IB. But I can't update it from code... ...I do something like this:

    MyController *tmpViewController = [[MyController alloc] initWithNibName:@"MyControllerView" bundle:nil];

    [cell addSubview:tmpViewController.view];

and I add it to the cell. But the cell only show the default nib view, instead of a updated one. I tried to update the background color, it successfully update.

What should I do to do so? Thank you.


It sounds like you didn't link the Outlet to your label in Interface builder.

Just control-click your label, drag it to your "File's Owner" (which should have the class set to "MyController") and select your outlet.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号