0
我有一個NSMutableArray與圖像,我想有一個簡單的滾動畫廊與他們。每張圖像均爲1024x768,在縱向時適合,在自動橫向時爲全屏。我正在使用ATPageView畫廊,但我無法處理所有這些東西。有什麼想法嗎? 這裏是我現在使用的:簡單的圖庫應用程序ios
- (UIView *)viewForPageInPagingView:(ATPagingView *)pagingView atIndex:(NSInteger)index
{
NSLog(@"In view for PV index %i", index);
// if (view == nil)
//{
float coef;
if (self.interfaceOrientation==UIInterfaceOrientationPortrait || self.interfaceOrientation== UIInterfaceOrientationPortraitUpsideDown)
{
coef=1.34f;
}
else
{
coef=1;
}
UIView *view = [pagingView dequeueReusablePage];
NSLog(@" Paging viewer View Size: %.2f %.2f", pagingViewer.frame.size.width, pagingViewer.frame.size.height);
NSLog(@" Paging viewer SUBVIEWS View Size: %@", [pagingViewer.subviews objectAtIndex:0]);
NSLog(@" Nutral View Size: %.2f %.2f",neutralView.frame.size.width, neutralView.frame.size.height);
//view.frame=CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width/coef, view.frame.size.height/coef);
UIImage *presentImg=[largeImagesFromGallery objectAtIndex:index];
view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, presentImg.size.width/coef, presentImg.size.height/coef)];
view.backgroundColor=[UIColor clearColor];
NSLog(@" Size of the view: %.2f %.2f",view.frame.size.width, view.frame.size.height);
UIScrollView *sv=[[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, presentImg.size.width/coef, presentImg.size.height/coef)];
sv.autoresizingMask=UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
UIImageView *img=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, presentImg.size.width/coef, presentImg.size.height/coef)];
img.image=[largeImagesFromGallery objectAtIndex:index];
img.tag=2000;
sv.contentSize=presentImg.size;
sv.maximumZoomScale=3.0f;
sv.delegate=self;
[sv addSubview:img];
view.autoresizingMask=UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[view addSubview:sv];
//}
return view;
}
什麼是您的問題/錯誤?您是否在尋找可重複使用的圖庫,或者您是否遇到此代碼的特定問題? – bryanmac 2012-02-06 12:31:50
我想我想有一個很好的可重用的gallary就像我已經使用 – 2012-02-06 12:33:59