是否可以在UIRefreshControl
標題中使用多行?每當我將\ n添加到NSAttributedString
時,只會顯示第一行。我正在嘗試設置標題,並在下一行添加更多文字。那麼在UIRefreshControl
中使用兩行文字是否有解決方法?UIRefreshControl歸因題目多行
這是當前的代碼顯示只有「標題下面」:
self.refreshControl = [[UIRefreshControl alloc] init];
NSString *title = @"Title Here";
NSString *subText = @"Subtext Here";
NSMutableAttributedString *attString=[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n%@",title,subText]];
[attString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Helvetica" size:20.0f] range:NSMakeRange(0, [title length])];
[attString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Helvetica" size:14.0f] range:NSMakeRange([title length],[subText length])];
[attString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0, [title length])];
[attString addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange([title length], [subText length])];
self.refreshControl.attributedTitle = attString;
這只是顯示他們彼此相鄰。 – ggfela 2013-04-22 12:25:50
不起作用,文本顯示爲彼此相鄰。有人提供正確的答案嗎? – eter 2013-12-19 08:59:56