代码:
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self
action:@selector(myAction:)
forControlEvents:UIControlEventTouchDown];
[button setTitle:NSLocalizedString(@"Action", @"")
forState:UIControlStateNormal];
CGFloat width = button.bounds.size.width;
但是宽度为0?这是为什么。请大家帮忙解答一下。谢谢
你不设 button.frame 它怎么会有宽度呢?