【问题标题】:Unable to assign image url to MWPhoto in iOS无法在 iOS 中将图像 url 分配给 MWPhoto
【发布时间】:2015-09-08 13:13:35
【问题描述】:

在我的应用程序中使用了https://github.com/mwaterfall/MWPhotoBrowser 库.. 但我无法分配图片网址 我如何分配图片网址。请解决我的问题 请检查我的代码:

 -(NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser
{
    return _photos.count;
}

- (MWPhoto *)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index
{
    if (index < _photos.count)
        return [_photos objectAtIndex:index];    return nil;
}


- (void)viewDidLoad
{
    [super viewDidLoad];
    NSMutableArray *photos = [[NSMutableArray alloc] init];

   // photos=[[NSMutableArray alloc]initWithObjects:@"1.jpg",@"2.jpg",@"3.png", nil];
    photos=[[NSMutableArray alloc]initWithObjects:@"http://www.google.co.in/imgres?imgurl=https://alaskabibleteacher.files.wordpress.com/2014/09/apple-tree.jpg&imgrefurl=http://brokenbelievers.com/2014/09/19/the-apple-tree/&h=606&w=808&tbnid=uY1OY_HyQ8hE1M:&docid=vKsOHUHBZ2CVFM&ei=1mXuVcu1O8rbuQTW_7Z4&tbm=isch&ved=0CDEQMygBMAFqFQoTCMv4zcvO5scCFcptjgod1r8NDw",@"http://www.apple.com/ipad/home/images/social/og.jpg?201508031746", nil];
    for (int i = 0; i < photos.count; i++)
    {
        [photos addObject:[MWPhoto photoWithURL:[NSURL URLWithString:photos[i]]]];
    }
    _photos = photos;
    MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
    UINavigationController *nc = [[UINavigationController alloc]     initWithRootViewController:browser];
    [browser showNextPhotoAnimated:YES];
    [browser showPreviousPhotoAnimated:YES];
    [self presentViewController:nc animated:YES completion:nil];

}

我更新了我的代码和错误... 我收到一个错误: [MWPhoto length]: unrecognized selector sent to instance 0x7febf97f4740 2015-09-08 10:43:16.231 Salon[3926:66068] *** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[MWPhoto 长度]:无法识别的选择器发送到实例 0x7febf97f4740”

【问题讨论】:

  • 你有什么错误吗?如果有,请发布。
  • no.. 我没有收到任何错误
  • 阿米拉:请检查错误

标签: ios objective-c xcode mwphotobrowser


【解决方案1】:

在您的Other linker Flags 中添加-ObjC-all_load 并检查,如果已经可用,则在构建设置中删除上述标志。

其他reference

【讨论】:

  • 祝你有美好的一天,我的妹妹
  • 我可以在循环中向多个图像视图添加多个图像 url 请检查我上传的代码
  • MWPhoto 计算你的数组计数,所以你的编码很好你面临的问题
  • [MWPhoto 长度]:无法识别的选择器发送到实例 0x7f8d7955ef10
猜你喜欢
  • 2011-08-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-25
  • 2018-10-31
  • 1970-01-01
  • 1970-01-01
  • 2018-10-21
相关资源
最近更新 更多