关于delegate,我想谈一谈做一个类似于UIAlertView的UIView的过程
1.首先创建了一个NotificationView,添加了delegate代码如下:
@protocol NotificationDelegate<NSObject>
@optional
-(void) clickButtonAtIndex:(int)indexOfButton OnView:(UIView*) notificationView;
@end
@interface NotificationView :UIView
...
@property (weak,nonatomic)id<NotificationDelegate>delegate;
...
@end
2.因为这种方法太过于繁琐,所以不再赘述,更好用的一种方法是用block来做简单的回调。