是否可以在UIRefreshControl
标题中使用多行?每当我将 \n 添加到NSAttributedString
唯一的第一行时,都会显示。我正在尝试设置标题,并在下一行设置更多文本。那么是否有一种解决方法可以在 中使用两行文本UIRefreshControl
?
这是仅显示“Title Here”的当前代码:
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;