2015-01-06 28 views
5

你會怎樣來顯示在Twitter的應用程序中的用戶的照片,其中照片媒體是正確的鍵盤這樣下:像Twitter應用程序中的顯示相機卷?

enter image description here

enter image description here

enter image description here

+0

我確實不知道Twitter如何實現(duh),但是你可以使用容器來實現這一點。只需在存儲器中創建'UIImagePicker',而不是使用'presentViewController ...',只需將其添加爲子視圖控制器即可。我還沒有測試過這種方法,所以我直到有人做這個評論。 – Oxcug

回答

0
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; 
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext; 
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
[self presentViewController:imagePickerController animated:YES completion:nil]; 
+0

只需點擊一個按鈕就可以顯示它,我希望它在View Controller中默認顯示。 – Prad

1

Add the AssetsLibrary framework

然後寫一些類似代碼:

@interface ImageCell : UICollectionViewCell 

@property (strong) UIImageView *imageView; 

@end 

@implementation ImageCell 

- (instancetype)initWithFrame:(CGRect)frame 
{ 
    self = [super initWithFrame:frame]; 

    self.imageView = [UIImageView new]; 

    [self addSubview:self.imageView]; 

    return self; 
} 

- (void)layoutSubviews 
{ 
    [super layoutSubviews]; 

    self.imageView.frame = self.bounds; 
} 

@end 

然後:

需要從這裏取決於應用程序的要求進行優化此代碼。它還需要自定義集合視圖框架和佈局以符合UI要求。

Screenshot of Result

+0

通過更新用戶界面來顯示'self.thumbnails',你的意思是什麼,你能告訴我一個一般的例子。 – Prad

+0

有很多代碼參與正確的做法,但是很確定。 – Dustin

0

有這麼完全相同的行爲class模仿:

enter image description here

你可以從這裏下載:Link

相關問題