TvOS: Using CollectionViewCells as a Button - swift

I am new to all of this, so please excuse if there is an obvious answer to my question.
I have a native tvOS application which incorporates a CollectionViewController very similar to that, which Apple uses in their UIKitCatalog.
I have set everything up programmatically, as I am not looking for a storyboard based answer. By default a user can interact with the cell, that is in focus, but how exactly would I achieve that by clicking a cell you are forwarded to a different view controller. I know how to do this with a Button and an IBAction, but I would like the cell to act as a button in this case, so how should I do this?
Thank you for your answers!
Regards Paul

You can achieve this by using UICollectionViewDelegate collectionView:didSelectItemAtIndexPath: i guess you can performSegue
https://developer.apple.com/library/tvos/documentation/UIKit/Reference/UICollectionViewDelegate_protocol/index.html#//apple_ref/occ/intfm/UICollectionViewDelegate/collectionView:didSelectItemAtIndexPath:

Related

Go back to previous storyboard

I'm currently developing a framework in Swift that includes a storyboard that I designed myself. What I need to do is that the user that uses my framework can create a segue to my storyboard. Then I'd like to be able to recreate a segue to the user storyboard that that I "leave" my storyboard.
How could I do so ?
Thx !
Your question is vague and I am not entirely sure what you are asking. However, I can't comment yet so I will try to answer with what little I know. It seems like you are asking how to transition storyboards. The simplest way is using a UIButton in your storyboard. Open up storyboard and go to the navigation controller. Then, add a button to the Nav Controller. Right click (or control click, depending on your settings), and drag the line to the main storyboard. Lastly, click on the show option. When a user clicks on the button, it will immediately switch to the main view controller. Don't forget to add the button in the view controller. Hopefully, this is what you meant and helps. If you wish switch view controllers in code, this is a duplicate and you should go here: How to switch view controllers in swift?. If this doesn't answer your question, comment and I will try and help. For future reference, please provide more information: snippets of code, pictures, anything that better demonstrates your problem.
I fixed it by getting the instance of a new view controller added on the user storyboard with the view controller identifier like so :
ProcessOut.backViewController = storyboard?.instantiateViewControllerWithIdentifier("back")
And then I present it like I would present a normal viewController from my storyboard.

how to implement something like this tableview? or viewcontroller or uialert? SWIFT

Picture Images to be done
Hi I'm having a hard time implementing something like this, is this a uiviewcontroller with a popup segue or a tableview controller? or just a simple alert? can anyone help me or can you provide a link with tutorials like this regards
Look Here
There is an example what you like.

Pull to refresh - Solution found but unable to implement it

I am using the example shown in the Pulltorefresh library. They have implemented it to fit a TableViewController class. But mine is a UIViewController, and i am adding a TableView in it.
I found a SO answer that shows a workaround for this. Can someone tell me how to implement it as described in the SO answer. Here's the link for the answer
That answer is not talking about using the library you are referencing. They are talking about how you would go about creating a UIScrollView with the "pull to refresh" functionality.
It shouldn't be that hard to transition the code to a UIViewController. Just change the code to subclass UIViewController and setup a UITableView property on the view controller (and make sure to set the data source & delegate of the UITableView to the view controller). There might be more to it but these are the basics. If you ask a more specific question about how to transition it to a UIViewController then maybe I (or someone else) can help more.
maybe you could try a different library?
I've used this one in the past, and it worked great!
http://cocoacontrols.com/platforms/ios/controls/egotableviewpullrefresh
Edit:
Here is the exact tutorial I used. He does exactly what you want. Adds the pull to refresh to a UITableView that is contained in a UIViewController!

How to tell when a subView is removed a UIView

Basically i wanted to implement a popup UIView so i followed what was posted here
POP-UP UIView "IMDB App" style
This works very well. However i have one query. My main view is a tableView. so when a view is popped up i disable scrolling in the table. Now when the popup subView is removed, i need to re-enable scrolling. How do i achieve that? i can't use willRemoveFromSuperview because the popup view is loading a different NIB altogether.
Should i use Notifications?
hope i was clear with explaining the scenario.
Thanks in advance!
Feloneous Cat has the correct answer. This is the perfect use a #protocol in your popup view along with a registered delegate. Something is triggering that popup view to close. Whatever that trigger is, call the protocol and the delegate can handle the situation as needed.
Furthermore, when protocols are used correctly, your code becomes very reusable within a project as well as in other projects.
What you could do is subclass UIView and override removeFromSuperview to send a notification. I don't think there's ever a case where a view gets removed without using the removeFromSuperview method.

UIToolbar above a Keyboard - iPhone SDK

I have seen this question posted several times with no useful answers. I am trying to place a toolbar above my UIKeyboard in my iPhone app, but am having difficulty. I found this example which works GREAT, except that my view is a UITableView instead of the standard [self.view addsubview:...]. Can anyone figure out how to apply this to a UITableView?
In short, I have several UITextFields in my table cells, so I want the toolbar to appear above the keyboard for those cells.
Many thanks,
Brett
Just don't use the table view directly as a view.
Use a view that will have a table view inside it.
This way you will be able to use the tutorial as is...
In my opinion this way is much better - I don't have view controller with a single table view in any of my applications. There is always something additional on the screen...
In addition, I don't think that using parentViewController is good solution.
Not always you have one.
Actually, I don't even understand how it works for you...
A work around for this would be to create a hidden textfield in a viewcontroller and present it modally with it begin the first responder. The view can be completely transparent and the toolbar can be configured using the interface builder.