我在我的项目中使用github中的RTSPagedView。这给了我这个警告

  Property type 'id<RTSPagedViewDelegate>' is incompatible with type 'id<UIScrollViewDelegate>' unherited from 'UIScrollView'




@property (nonatomic, assign) IBOutlet id <RTSPagedViewDelegate> delegate;

RTSPagedView.h

应用与此警告一起正常运行。任何人都曾经遇到过这个问题,或者知道解决方案请提供帮助。

链接为RTSPagedView

//  RTSPagedView.h
//  PagedView
//  http://github.com/rplasman/RTSPagedView

#import <UIKit/UIKit.h>

@protocol RTSPagedViewDelegate;

@interface RTSPagedView : UIScrollView

@property (nonatomic, assign) IBOutlet id <RTSPagedViewDelegate> delegate;
@property (nonatomic, assign) NSUInteger currentPage;
@property (nonatomic, readonly) NSUInteger numberOfPages;
@property (nonatomic, assign) BOOL continuous;

- (void)resizeBounds:(CGRect)bounds;
- (UIView *)dequeueReusableViewWithTag:(NSInteger)tag;
- (UIView *)viewForPageAtIndex:(NSUInteger)index;
- (void)scrollToPageAtIndex:(NSUInteger)index animated:(BOOL)animated;
- (void)reloadData;
- (NSUInteger)indexForView:(UIView *)view;

@end

@protocol RTSPagedViewDelegate <UIScrollViewDelegate>

- (NSUInteger)numberOfPagesInPagedView:(RTSPagedView *)pagedView;
- (UIView *)pagedView:(RTSPagedView *)pagedView viewForPageAtIndex:(NSUInteger)index;

@optional

- (void)pagedView:(RTSPagedView *)pagedView didScrollToPageAtIndex:(NSUInteger)index;
- (void)pagedView:(RTSPagedView *)pagedView didRecycleView:(UIView *)view;
@end

最佳答案

发生问题是因为

 @property (nonatomic, assign) IBOutlet id <RTSPagedViewDelegate> delegate;


在这种情况下,由于UIScrollViewDelagate是从RTSPagedView继承的,因此下沉倾向是UIScrollView

用其他任何名称修改完整的委托人名称

 @property (nonatomic, assign) IBOutlet id <RTSPagedViewDelegate> rtspDelegate;


它将删除警告。

08-05 23:08