![](/img/trans.png)
[英]Angular app on IOS doesn't show me keyboard, when i click on input. Why?
[英]Why the view doesn't show when I click the button in IOS?
我是IOS的新手,我想通過IOS中的collectionView
實現相冊。
當我在first View
單擊filebrowserbutton button
時,它將更改為second View
(名稱: AITCameraCollectionBrowser )。
如下圖所示, AITCameraCollectionBrowser
有兩個button
和一個collectionView
。
它的頭文件的代碼類似於以下代碼。
#import <UIKit/UIKit.h>
@interface AITCameraCollectionBrowser : UIViewController <UICollectionViewDelegate, UICollectionViewDataSource>
@property (strong, nonatomic) IBOutlet UIButton *backButton;
@property (strong, nonatomic) IBOutlet UIButton *localAlbumButton;
@property (strong, nonatomic) IBOutlet UICollectionView *collectionview;
@end
我還沒有加載從手機的圖片還沒有,所以它應該顯示view
像上面的圖片當我點擊change view button
在first view
。
filebrowserbutton button
的代碼如下。
- (IBAction)filebrowserbutton:(id)sender {
UIViewController *viewController = nil ;
viewController = [[AITCameraCollectionBrowser alloc] initWithNibName:@"AITCameraCollectionBrowser" bundle:nil] ;
viewController.edgesForExtendedLayout = UIRectEdgeNone;
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back", nil) style: UIBarButtonItemStyleBordered target:nil action:nil] ;
[self.navigationController pushViewController:viewController animated:YES];
}
上面的button
在first view
代碼沒問題。
但是當我單擊filebrowserbutton button
,它什么都沒有顯示,它在屏幕頂部只有一個backBarButtonItem
。
所以問題出在第二個視圖上,我不知道為什么button
和collectionView
沒有顯示?
在您的標頭或.h
文件中,添加以下代碼
- (IBAction)filebrowserbutton:(id)sender;
接下來,在xib
或storyboard
xib
文件中,必須將文件所有者的filebrowserbutton
(通過右鍵單擊第一張圖片左側的黃色透明框)連接到該按鈕,然后選擇touch up inside
。
您需要添加- (IBAction)filebrowserbutton:(id)sender;
到頭文件,然后將其連接到按鈕的touchDown
方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.