![](/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.