我在 xib 中有 uiButtons。我已经为所有这些设置了恢复 ID。我需要打印这些恢复 ID 的列表。为此,我在 viewDidload 中调用以下代码:
-(void)loadViewFromNIB:(NSString *)nibName owner:(id)owner
{
NSArray *objects = [[NSBundle mainBundle] loadNibNamed:nibName owner:owner options:nil];
NSArray *subviews = [[objects objectAtIndex:0]subviews];
for (id key in subviews) {
[key addTarget:self
action:@selector(touchB:)
forControlEvents:UIControlEventTouchDown];
[key addTarget:self
action:@selector(touchE:)
forControlEvents:UIControlEventTouchUpInside];
NSString *ident = self.restorationIdentifier;
NSLog(@"%@",ident);
}
我得到这个输出:
2013-02-24 13:05:38.817 fozbKEY[3939:11603] (null)
2013-02-24 13:05:38.822 fozbKEY[3939:11603] (null)
2013-02-24 13:05:38.824 fozbKEY[3939:11603] (null)
这只是重复一堆。我做错了什么?我如何解决它?谢谢!