嗨,我的问题是设置多个行到我的按钮,这被声明为:
button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.titleLabel.font = [UIFont systemFontOfSize: 12]; button.titleLabel.lineBreakMode = UILineBreakModeWordWrap; button.titleLabel.numberOfLines = 0; button.titleLabel.shadowOffset = CGSizeMake (1.0,0.0); [button addTarget:self action:@selector(myButtonClick) forControlEvents:UIControlEventTouchDown]; button.frame = CGRectMake(0.0,100.0,317.0,100.0); [button setTitle:string forState:UIControlStateNormal]; button.titleLabel.font = [UIFont systemFontOfSize: 12]; button.titleLabel.text = @"ahoj"; NSMutableString *ObratString = [[NSMutableString alloc] initWithString:button.titleLabel.text]; [ObratString appendString:@"\n"]; [ObratString appendString:@"caw"]; [ObratString appendString:@"\n"]; [ObratString appendString:@"helllo"]; button.titleLabel.text = ObratString; [ObratString release]; [self.view addSubview:button];
但最后我只看到第一行.
有什么办法让它工作吗?