我有一个基于故事板的应用程序,我想使用MWPhotoBrowser。我使用cocoaPods将MWPhotoBrowser添加到我的项目中。在我的故事板中,我有一个名为PhotoBrowserViewController的视图控制器,我可以通过按下另一个视图控制器的按钮来访问它。在我的PhotoBrowerViewController中,我只能看到我设置的标题,而不能看到我添加的照片?有谁可以帮我?
PhotoBrowserViewController.h
#import <UIKit/UIKit.h>
#import "MWPhotoBrowser.h"
@interface PhotoBrowserViewController : UIViewController<MWPhotoBrowserDelegate>
@property (nonatomic, strong) NSMutableArray *photos;
@endPhotoBrowserViewController.m
#import "PhotoBrowserViewController.h"
@interface PhotoBrowserViewController ()
@end
@implementation PhotoBrowserViewController
- (void)awakeFromNib
{
self.title = @"MWPhotoBrowser";
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
browser.displayActionButton = YES;
[self.photos addObject:[MWPhoto photoWithURL:[NSURL URLWithString:@"http://www.ournorthstar.com/wp-content/uploads/2013/10/test1.jpg"]]];
}
- (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser {
return _photos.count;
}
- (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index {
if (index < _photos.count)
return [_photos objectAtIndex:index];
return nil;
}
@end发布于 2015-02-13 14:36:21
首先,检查这个类是否符合MWPhotoBrowserDelegate
其次,您需要从(id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index方法返回MWPhoto对象
我想这就是问题所在
https://stackoverflow.com/questions/27575736
复制相似问题