Tag: 视图

用另一个视图为每个UITableViewCellbuild立一个链接

我是iOS编程的新手,我想做一件简单的事情。 我看到了几个有关我的问题的主题,但我不明白为什么我的代码不工作… 我用.xib创build了一个名为details2ViewController的UIViewController子类 在我的主视图叫ViewController.xib ,我有一个tableView 在ViewController.m中 ,我在顶部添加了: #import "details2ViewController.h" 在ViewController.m中 ,我修改了didSelectRowAtIndexPath方法,如下所示: details *det = [[details alloc] init]; [self.navigationController pushViewController:det animated:YES]; 没有任何警告,但是当我点击一个单元格时没有任何效果…我确切地说我没有使用mainStoryBoard。 注意: 这是我以前的post关于这个问题。 (对不起,如果我的英文很尴尬,我是法语…感谢您的帮助!)

使用UIViewController像Slck一样滑动UIInputView

我想使用UIViewController的input附件视图是这样的: override func canBecomeFirstResponder() -> Bool { return true } override var inputAccessoryView: UIView! { return self.bar } 但问题是我有一个抽屉如视图,当我滑动视图打开,input视图停留在窗口上。 我怎样才能保持input视图像中央视图像松弛这样做。 在我的input视图停留在底部的情况下,占用全屏幕(红色是下图中的input视图):

如何从GCD返回UIImagetypes

我有一个名为“ComLog”的“UIImage”返回types的方法。 我想从这个方法返回一个图像。 在“ComLog”方法中,我使用GCD从数组中获取图像值。 我使用下面的代码,“NSLog(@”qqqqqqqqqqq%@“,exiIco)”打印'图像'的值,但NSLog(@“qqqqqqqqqqqq%@”,exiIco);“不要这样的细节: -(UIImage*) ComLog { ExibitorInfo *currentExibitor100 = [[ExibitorInfo alloc] init]; currentExibitor100 = [self.exibitorsArray objectAtIndex:0]; imageQueueCompanyLogo = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul); dispatch_async(imageQueueCompanyLogo, ^ { UIImage *imageCompanyLogo = [UIImage imageWithData:[NSData dataWithContentsOfURL: [NSURL URLWithString:[currentExibitor100 companyLogoURL]]]]; dispatch_async(dispatch_get_main_queue(), ^ { self.exibitorIcoImageView.image = imageCompanyLogo; exiIco = imageCompanyLogo; NSLog(@"qqqqqqqqqqq %@", exiIco); }); }); return exiIco; } – (void)viewDidLoad { [super viewDidLoad]; […]

本机视图呈现反应本机视图

有没有人知道我可以有一个本地的UIViewController目前或推动反应原生视图,并在两者之间来回? 如果可能的话,我想在UIViewController中加载React Native视图,这样我可以保留我的导航栏,但使用React Native视图。 我一直在阅读文档 ,但我一直无法find任何可行的方法。 我试过这样的组合: // RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:nil launchOptions:nil]; // RCTRootView *reactView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"My Test" initialProperties:nil]; NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; RCTRootView *reactView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@"My Test" initialProperties:nil launchOptions:nil]; reactView.frame = self.view.frame; [self.view addSubview:reactView]; 我不是很确定,我知道它是如何知道.js React文件我希望它使用,或者我如何指定。

如何启动设备types的特定视图

我正尝试在启动时启动3个视图中的1个。 我想要启动的视图取决于设备types。 这是我到目前为止在AppDelegate.m – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 568.0) { self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_Portrait5" bundle:nil]; } else if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 480.0) […]

Stackview不附加第二个视图

我以编程方式创build了一个堆栈视图,并且添加了一个我已经以编程方式创build的视图。 但是,当我尝试添加第二个视图不起作用。 这是我的代码: @IBOutlet weak var codingScrollView: UIView! let codeStackView = UIStackView() var codeViews = [CodeView]() let codeView1 = CodeView(name: "Lennart", date: "13/05/2002", code: "Just some code") let codeView2 = CodeView(name: "Nina", date: "01/07/1999", code: "Also some code") codingScrollView是我添加到UIScrollView的contentview。 codeStackView是我之前描述的codeViews数组正在被用来添加视图到stackview。 这里是viewDidLoad方法: codeViews.append(codeView1) codeViews.append(codeView2) codingScrollView.addSubview(codeStackView) codingScrollView.backgroundColor = UIColor(red: 226/255, green: 226/255, blue: 226/255, alpha: 1) codeStackView.centerXAnchor.constraint(equalTo: […]

UITableView didSelectRowAtIndexPath从不调用

我有UITableView里面的UIViewController采用UITableViewDelegate & UITableViewDataSource协议。 numberOfRowsInSection和cellForRowAtIndexPath被实现。 故事板中有数据源和代表的出口。 TableViewselect单一select。 检查触摸时显示select。 我在模拟器上运行项目,触摸表单元格,得到了didHighlightRowAtIndexPath调用,但didSelectRowAtIndexPath或willSelectRowAtIndexPath永远不会被调用。 我忘了什么 什么可以影响TableView这种方式? PS我知道,有这样的问题很多,但我已经花了几个小时的谷歌search和阅读stackoverflow,仍然没有解决我的问题。 TestViewController.h: @interface TestViewController : ViewController <UITableViewDelegate, UITableViewDataSource> @end TestViewController.m: @interface TestViewController () @property (strong) IBOutlet UITableView *tableView; @end @implementation TestViewController – (void)viewDidLoad { [super viewDidLoad]; } – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"selected"); } – (void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"highlighted"); } – (NSInteger)numberOfSectionsInTableView:(UITableView […]

UIView框架问题

我有一个奇怪的问题。 我有两个视图控制器。 一个homeViewController和一个settingViewController。 homeViewController在settingViewController有没有导航栏。 现在的问题是,当我推settingViewController,并从它回来我homeViewController视图的高度变小。 (视图的高度 – 导航栏高度) (不想手动调整帧) // homeViewController -(void) settingButtonPressed { SettingsViewController *svc = [[SettingsViewController alloc] init]; [self.navigationController pushViewController:svc animated:YES]; } // settingViewController -(void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.navigationController.navigationBarHidden = NO; self.navigationController.navigationBar.barStyle = UIBarStyleDefault; self.navigationItem.hidesBackButton = NO; [UIApplication sharedApplication].statusBarHidden = YES; UIInterfaceOrientation statusBarOrientation =[UIApplication sharedApplication].statusBarOrientation; [self willAnimateRotationToInterfaceOrientation:statusBarOrientation duration:0.0]; } -(void) viewWillDisappear:(BOOL)animated { […]

如何判断一个子视图何时被移除一个UIView

基本上我想实现一个popup的UIView,所以我跟着这里发布的popup式UIView“IMDB应用程序”风格 这工作得很好。 不过,我有一个查询。 我的主视图是一个tableView。 所以当一个视图popup时,我禁用在表中滚动。 现在当popup的子视图被删除,我需要重新启用滚动。 我如何实现这一目标? 我不能使用willRemoveFromSuperview,因为popup视图加载一个不同的NIB。 我应该使用通知吗? 希望我清楚地解释了这种情况。 提前致谢!

如何确定从iOS中的背景返回到前台加载哪个视图?

我有一个应用程序有多个视图。 当我从背景中回到前景时,我想确定我目前在哪个视图。 我该怎么做? [编辑] 我明白navigationController的visibleViewController属性可能会有所帮助。 但是,我想知道如何在UIViewController对象中使用它返回的指针。 我们如何比较指针? 一些代码片段会非常有帮助。