cdu*_*dub 1 objective-c ios objective-c-category ios7
我有一个UIColor + MyLayout.m文件,例如:
@implementation UIColor (Layout)
- (UIColor *) textBackground
{
UIColor *lightGreen = [UIColor colorWithRed:0.0f/255.0f green:178.0f/255.0f blue:238.0f/255.0f alpha:1.0f];
return lightGreen;
}
@end
Run Code Online (Sandbox Code Playgroud)
我已将.h文件添加到我的viewcontroller.m中,但是如何将其调用为UIColor?
UIColor*myColor =?
Mac*_*zko 10
如果您执行以下操作会更好:
@implementation UIColor (Layout)
+ (UIColor *) textBackground {
UIColor *lightGreen = [UIColor colorWithRed:0.0f/255.0f green:178.0f/255.0f blue:238.0f/255.0f alpha:1.0f];
return lightGreen;
}
@end
Run Code Online (Sandbox Code Playgroud)
然后打电话给它 UIColor *myColor = [UIColor textBackground];
归档时间: |
|
查看次数: |
6365 次 |
最近记录: |