From the documentation of -[NSArray indexOfObjectIdenticalTo:]
Posted on 2013-02-01 15:05 酸梅拯救地球 阅读(301) 评论(0) 收藏 举报From the documentation of -[NSArray indexOfObjectIdenticalTo:]:
Return Value
The lowest index whose corresponding array value is identical to anObject. If none of the objects in the array is identical to anObject, returns
NSNotFound.
and NSNotFound is defined as:
enum{NSNotFound=NSIntegerMax};
and 2147483647 = 0x7fffffff is the maximum integer in iOS.
//buttonId is NSArray
- (void)eventTouchObserved:(id)sender
{
UIButton *touchedButton = [buttonId objectAtIndex:[buttonId indexOfObjectIdenticalTo:sender]];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:touchedButton cache:NO];
[UIView commitAnimations];
[touchedButton setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@.png",[touchedButton currentTitle]]] forState:UIControlStateNormal];
}
浙公网安备 33010602011771号