我想擴展UIButton
與NSString
一些元信息。我怎麼能這樣做?添加NSString類別擴展到UIButton
我開始與此:
@interface UIButton (neoUtils)
+ (UIButton *)neoName:(NSString *)buttonName;
@end
與.m
#import "UIButton+NAME.h"
@implementation UIButton (neoUtils)
+ (UIButton *)neoName:(NSString *)buttonName {
UIButton *button = [UIButton neoName:buttonName];
NSLog(@"%@",button);
return button;
}
@end
這是在正確的道路上?如果是這樣 - 我將如何使用它?
這個問題不是重複的,但它已經在不同的上下文中回答過。請參閱http://stackoverflow.com/questions/10414718/subclassing-nsnumber。 – 2012-07-31 22:27:47
這似乎是我正在尋找。謝謝 – malaki1974 2012-08-01 13:04:40