我有一个viewcontroller和uicollectionview它在里面.
我使用了以下代码,但没有可见的图像uicollectionview,只有黄色框:
myviewcontroller.h
{
IBOutlet UICollectionView *gallery1;
//IBOutlet UIImage *inimage;
NSArray *recipePhotos;
}
@property (nonatomic, retain) IBOutlet UICollectionView *gallery1;
//@property (nonatomic, retain) IBOutlet UIImage *inimage;
Run Code Online (Sandbox Code Playgroud)
和myviewcontroller.m
- (void)viewDidLoad
{
[super viewDidLoad];
recipePhotos = [NSArray arrayWithObjects:@"im1.png","im2.png", "im3.png", "im4.png", "im5.png", "im6.png", nil];
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
[flowLayout setItemSize:CGSizeMake(100, 100)];
[flowLayout setScrollDirection:UICollectionViewScrollDirectionVertical];
[self.gallery1 setCollectionViewLayout:flowLayout];
[self.gallery1 setAllowsSelection:YES];
self.gallery1.delegate=self;
}
- (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection: (NSInteger)section {
return recipePhotos.count;
}
- (NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionView {
return 1;
} …Run Code Online (Sandbox Code Playgroud) 我发现了类似的问题,但没有一个解决了我的问题.
有一些viewcontrollers和工作应用程序.
我向其中一个viewcontrollers添加了一个按钮,并绑定了一个"sampleclick"动作.此操作中没有任何内容(没有代码,没有行,只是一个空方法),应用程序与以下块崩溃:
所有输出日志:
(lldb)
Run Code Online (Sandbox Code Playgroud)
和堆栈:
libobjc.A.dylib`objc_msgSend:
0x10ed08c: movl 8(%esp), %ecx
0x10ed090: movl 4(%esp), %eax
0x10ed094: testl %eax, %eax
0x10ed096: je 0x10ed0e8 ; objc_msgSend + 92
0x10ed098: movl (%eax), %edx
0x10ed09a: pushl %edi
0x10ed09b: movl 8(%edx), %edi
0x10ed09e: pushl %esi
***0x10ed09f: movl (%edi), %esi >>> crashes here with :Thread1:EXC_BAD_ACCESS*** (code=1,address: .....)
0x10ed0a1: movl %ecx, %edx
0x10ed0a3: shrl $2, %edx
0x10ed0a6: andl %esi, %edx
0x10ed0a8: movl 8(%edi,%edx,4), %eax
0x10ed0ac: testl %eax, %eax
0x10ed0ae: je 0x10ed0b9 ; objc_msgSend + 45
0x10ed0b0: cmpl …Run Code Online (Sandbox Code Playgroud)