uiviewcontroller

How to show view controller on selecting row cell of tableView(as a collection view cell)?

杀马特。学长 韩版系。学妹 提交于 2020-02-06 07:54:00
问题 I have the Main View Controller which has a collection view with its collection view cells each initialized as a tableView to serve multiple rows inside of that collection view cell. If you're getting confused, below is the snapshot of the current state. The problem is when I try to tap a tableView row cell to open another view controller, It fails and a selected state of table view cell is shown. Here is the snapshot. //HomeCollectionViewCell.swift class HomeCollectionViewCell:

Function across multiple view controllers

随声附和 提交于 2020-02-05 04:28:42
问题 I am trying to make a function so that I request a 'manager override' where it presents a screen for a manager to enter their password and press an approve button. How should I do this? Will it have to be in multiple functions? Is there a way that I can call one function and it present the information back? Would a completion work for what I need? I have no ideas where to start for this. My set up is as follows: A view controller asks for manager approval, then a screen slides up with text

Swift Save viewcontroller state using coder beyond app close

早过忘川 提交于 2020-01-30 06:33:25
问题 I am using Xcode 8 and swift 2.3 I want to save the entire view controller to file and restore state even after app closes. I searched everywhere and found we need to use coder for that. but all just shows to save an object. but here I need to save entire ViewContoller and subviews. ViewCotroller will have three buttons Add Text Add Image : User can add any number of textViews and Images. So I need to save all that info also. Add ViewController : User may have an array of this viewController

Swift Save viewcontroller state using coder beyond app close

心不动则不痛 提交于 2020-01-30 06:32:31
问题 I am using Xcode 8 and swift 2.3 I want to save the entire view controller to file and restore state even after app closes. I searched everywhere and found we need to use coder for that. but all just shows to save an object. but here I need to save entire ViewContoller and subviews. ViewCotroller will have three buttons Add Text Add Image : User can add any number of textViews and Images. So I need to save all that info also. Add ViewController : User may have an array of this viewController

Terminating app due to uncaught exception 'NSUnknownKeyException' : iOS app crash [duplicate]

北战南征 提交于 2020-01-29 06:38:24
问题 This question already has answers here : Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error? (69 answers) Closed 6 years ago . I'm a beginner programmer working on iPhone apps. I was wondering if anybody could help me with a bug in my app. When programming on XCode I found that my app suddenly crashed on launch after adding a little more code. The output panel showed the following error: * Terminating app due to uncaught

How to send an NSString to another view controller

人走茶凉 提交于 2020-01-28 12:34:11
问题 I have an IBAction that when triggered calls another method in a different view controller ( APICallsViewController). I'm looking to also send that method an NSString (message) here's my IBAction with the push to the APICallsViewController and also the NSString message. My question might be how do I grab the contents of that NSString in the other view controller's method. thanks for any help -(IBAction) someMethod{ APICallsViewController *apiViewController = [[APICallsViewController alloc]

How to send an NSString to another view controller

丶灬走出姿态 提交于 2020-01-28 12:30:09
问题 I have an IBAction that when triggered calls another method in a different view controller ( APICallsViewController). I'm looking to also send that method an NSString (message) here's my IBAction with the push to the APICallsViewController and also the NSString message. My question might be how do I grab the contents of that NSString in the other view controller's method. thanks for any help -(IBAction) someMethod{ APICallsViewController *apiViewController = [[APICallsViewController alloc]

Segue not setting value to detail view controller

你离开我真会死。 提交于 2020-01-25 11:03:05
问题 I have a Master-Detail VC set up and I've figured out how to set up a segue to my Detail VC. The code below doesn't crash, but it also doesn't send a value for the label to the VC I'm pushing to. I'm stumped as to how I pass the value of detailViewController.detailItem = selectedNote?.noteBody to my DetailViewController . The code below compiles. It does not crash. But it also doesn't set anything on my DetailViewController . override func tableView(tableView: UITableView,

Swift: safe area on iPhone

柔情痞子 提交于 2020-01-25 09:01:36
问题 I have ViewController with collectionView and collectionView bottom, top, leading, trailing constraints to superview. And on iPhone 8 my screen look like this: And for another devices all looks fine. But on iPhone X look like this: I use this code for my cells: func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { let offset: CGFloat = 10 let width = collectionView.bounds.width / 3 - offset

Swift: safe area on iPhone

我只是一个虾纸丫 提交于 2020-01-25 09:01:08
问题 I have ViewController with collectionView and collectionView bottom, top, leading, trailing constraints to superview. And on iPhone 8 my screen look like this: And for another devices all looks fine. But on iPhone X look like this: I use this code for my cells: func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { let offset: CGFloat = 10 let width = collectionView.bounds.width / 3 - offset