0
我想設置一個標題以UIButton
中的自定義顏色加下劃線,NSForegroundColorAttributeName: [UIColor colorWithRed:38 green:105 blue:255 alpha:1]
未應用於我的按鈕。如何在iOS中設置Attributed按鈕的顏色?
NSDictionary *attrDict = @{NSFontAttributeName : [UIFont systemFontOfSize:14],NSForegroundColorAttributeName : [UIColor colorWithRed:38 green:105 blue:255 alpha:1], NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle)};
NSMutableAttributedString *mat = [[NSMutableAttributedString alloc] initWithString:linkUrl];
[mat addAttributes:attrDict range:NSMakeRange (0, mat.length)];
[self.weblink setAttributedTitle:mat forState:UIControlStateNormal];
你真的應該申報'w'作爲'CGFloat',不只是'float'所以它的類型相匹配的是'UIColor'參數。 – rmaddy