を働く、" n" はUITextViewに追加改行ではなく、対象を1として
- (void)viewDidLoad
{
// Add Scroll View
CGRect fullScreenRect = [[UIScreen mainScreen] applicationFrame];
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:fullScreenRect];
self.view = scrollView;
// Configure Scroll View
scrollView.contentSize = CGSizeMake(320, 500);
// Shop Detail
CGRect shopDetailFrame = CGRectMake(20, 5, 300, 80);
UITextView *shopDetail = [[[UILabel alloc] initWithFrame:shopDetailFrame] autorelease];
shopDetail.backgroundColor = [UIColor whiteColor];
shopDetail.font = [UIFont boldSystemFontOfSize:15];
NSString *shopName = @"Shop A, G/F, 1/F-3/F, Lok Sing Building, 16 Kau Yuk Road";
shopDetail.text = [[shopName stringByAppendingString:@"\n"] stringByAppendingString:shopName];
[scrollView addSubview:shopDetail];
[super viewDidLoad];
}
以下のように私のコードが出力されていると仮定します。
Shop A, G/F, 1/F-3/F, Lok Sing Building, 16 Kau Yuk Road
Shop A, G/F, 1/F-3/F, Lok Sing Building, 16 Kau Yuk Road
しかし、私は得た:
Shop A, G/F, 1/F-3/F, Lok Sing Building, 16 Kau Yuk Road...
\n
はUITextViewでは動作しません。誰でもUITextViewで改行を行う方法を知っていますか?
おかげ
+1ありがとうございます –