을 수행 할 때 사진 격자보기를 만들지 만 실행하면 충돌이 발생하여 스레드 1을 움직입니다. m.file의내 프로젝트에서 MWPhotoBrowser를 사용할 때 스레드 1 중단 점 5.1을 사용합니다. 내 사진 브라우저 프로젝트에 'MWPhotoBrowser'를 추가하려고 할 때
#import <Foundation/Foundation.h>
#import "MWPhotoBrowser.h"
#import <AssetsLibrary/AssetsLibrary.h>
@interface DEMOSevenViewController : UIViewController <MWPhotoBrowserDelegate>
{
NSArray *_photos;
}
@end
코드 :
#import "DEMOSevenViewController.h"
#import "SDImageCache.h"
@interface DEMOSevenViewController()
@end
@implementation DEMOSevenViewController
#pragma mark - MWPhotoBrowserDelegate-
-(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];
for (int i = 0; i < 12; i++)
{
MWPhoto* photo = [MWPhoto photoWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"photo5" ofType:@"jpg"]]];
photo.caption = @"Fireworks";
[photos addObject:photo];
}
_photos = photos;
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
browser.displayActionButton = YES;
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:browser];
nc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:nc animated:YES];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
일을보기 바랍니다 5.1 브레이크 포인트, 나는 h.file의
코드 아래에 내 코드를 붙여 넣은 e 충돌 로그 –
ViewDidLoad에 MWPhotoBrowser를 표시하려고하면 문제가 발생합니다. 이 코드를 viewDidAppear 메서드에 추가하십시오. –
안녕하세요 형제 님, 조언을 주셔서 감사합니다. ViewDidAppear 메서드에이 코드를 추가했지만 실행하면 격자보기가 표시되지 않습니다. – user3376284