Witam mam problem dla wielu wymienionych linii do mojego przycisk, który jest zadeklarowane tak:wiele linii w UIButton
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];
Ale w końcu po prostu zobaczyć pierwszą linię. Czy jest jakiś sposób, aby to działało?
Możliwy duplikat http://stackoverflow.com/questions/2265940/ breakline-in-uibutton-title – fresskoma
Zobacz inne pytanie i kilka odpowiedzi na ten temat - [tutaj] (http://stackoverflow.com/questions/604632/how-do-you-add-multi-line-text-to-a -uibutton) –