I'm trying to create a popover from a NSToolbarItem using storyboards. I'm using OS X 10.11 beta 3 and Xcode beta 3. This is my setup:
before beta 3 I simply placed a view controller near the window controller, then dragged from the toolbar item to the controller and selected the segue way to be a popover. I then ran the program and it would work automatically no problem.
On beta 3 this is what happens after I click on the toolbar item at run time:
did something change in swift? do I have to manually implement something there? or is there a bug?
Ps. I tried placing a button in the Window Controller's Content View controller (The "Hi" button in my example), then created a segue way from that button to another view controller with popover and that works fine.
Related
How to collapse a codename one accordion component programmatically?
In my App, I have an accordion that expands a body container with some radio buttons. I want to collapse (Close) the body automatically when a radio button is selected.
Adding more details about the problem:
My intention is create a component that has same behavior of a ComboBox, but using Accodion component as base class.
I wrote a minimal use case that reproduce the problem and you can get its source file here MyApplication.java.This code implements Steve Hanna answer.I suppose. And it didn't work for me. Running this code is simple.
Just create a CodeName One project and replace the MyApplication.java file generated by CodeName One Wizard and run the project (I use Netbeans IDE).
I put inside Radio Button action the command to collapse the component as you can see at lines 271 til 280. But it didn't work.
In the radio button's action listener, check if it's not selected and then call collapse(bodyContainer) on the accordion.
EDIT: There was a bug in Accordion that caused collapse() to work incorrectly. This has now been fixed, and will be available in the next plugin update.
See this sample to see correct usage.
Note that after calling collapse(component), you should call the Accordion's animateLayout() method so that the change is shown.
In my app, many view controllers have a Container View containing a sort of "dashboard", with several buttons and labels shared throughout the app.
When segueing between two view controllers, what normally happens is:
1) the new view controller's viewDidLoad is called;
2) the new view controller's viewWillAppear is called;
3) the dashboard's viewDidLoad is called (there is an automatic segue to it, since it's inside a Container View);
4) the dashboard's viewWillAppear is called;
Now, in the dashboard's viewWillAppear method, I do some formatting of the different labels (changing their text and color). However, in iOS 8.3 this seems to have no effect. For example, I do the following to change a button's label:
self.myButton.titleLabel.text = #"myText";
and yet, right after the execution of this instruction, doing a
(lldb) po self.myButton.titleLabel.text
at the debugger prompt, will output the previous content of that button's label (from the storyboard) instead of "myText". Needless to say, everything works fine up to iOS 8.2 (including iOS 7).
So my question is: was anything changed at the view/segue lifecycle level in iOS 8.3?
You must use [myButton setTitle:forState:] to change the title of a button. If it worked before, it was by pure luck.
The iPad app that I'm working on makes use of Storyboards and segues. I'm trying to display a different view controller when the user clicks on different cells in the master view.
After referring to different tutorials, the steps that were taken were -
In the Storyboard, Master View Controller, created static cells for the table view and added 3 different rows (i.e. cell 1, cell 2, cell 3)
Added a View Controller, selected it and attached a Navigation Controller to it (Editor -> Embed In -> Navigation Controller)
From cell 1 in Master View, I did a ctrl-click on the Navigation Controller.
Chose Segue Style "Replace" and Destination "Detail Split"
In tableView:didSelectRowAtIndexPath, added [self performSegueWithIdentifier:#"NewViewController" sender:self] to do the transition.
The result that I see is the detail view gets replaced.
But the navigation bar does not have the bar button item Master.
So I'm unable to click the Master button which would show the table containing cells from where I can navigate to a different view.
I've already read many blogs and seen commentary which talk about replacing a segue for similar problems. However nobody seems to have faced this specific issue while using storyboards and segues.
From my understanding using segues should help me achieve what I want. From those who have tried this approach, any pointers in the right direction will be helpful.
Try changing the Segue Style from Replace to Push. It should resolve your problem.
When you push a UIViewController on a UINavigationController, it will be added to a stack and you will be able to navigate back :
Your navigation controller stack before tapping "Detail":
Master
Your navigation controller after tapping detail and navigating a little more ...:
Master -> Detail (Navigation button is displayed) -> Some other details (Navigation button is displayed) -> And maybe some more (Navigation button is displayed)
When you call a new segue using Replace like you did, the Master will be replaced with Detail, and you will not be able to navigate back because Master was replaced and it's not on the stack anymore.
Your navigation controller stack before tapping "Detail":
Master
Your navigation controller after tapping detail using replace like you did:
Detail (no navigation button because master was replaced and we don't have nothing more on the stack)
Looking for a tutorial or help doing the following
Keep it as an iPad App and using Storyboards. I need a (this is my Main) viewController (No Detail or Navigation View) with a popover that displays a UiCollectionView (and the Cells) of images). I want a ContainerView inside my main). The Container displays a default imageView and selection from the CollectionView, changes the Image in the Container. Also, the segue from the CollectionView Cell to the Container's Imageneeds to be of Custom Segue Type.
Remember, it's for an IPad, with Storyboard. No detail or Navigation Controller.
How's that for a Tutorial. There is nothing else like it right now and I could sure use the help.
Doug
This one appears pretty good.. The code is also sitting on github..
Tutorial: http://maniacdev.com/2012/09/tutorial-how-to-create-an-ios-6-uicollectionview-using-storyboards/
Source: https://github.com/AshFurrow/UICollectionViewExample
Yet another UICollectionView tutorial
Like the title said,how may i turn the grid(or page) and the components in it into background gray and unable and show a new component in foreground.
It's a common effect in the web page,but i cannot do that with a xaml.
Please answer in detail better with sample code if you do.Thanks in advance.
Here's an example of using a Popup to display a UserControl when a Page is navigated to. The OnNavigatedTo function creates a popup, binds a Click event to the UserControl, and then shows the UserControl over the entire page. If the correct password is entered, ("password" in the example) the control disappears. You'll need to modify it for your own requirements, but it should definitely get you started.
https://skydrive.live.com/redir.aspx?cid=ef08824b672fb5d8&resid=EF08824B672FB5D8!343
You'll want to use the VisualStateManager and create some animation transitions to switch between the old and new components. I won't paste the code here for brevity, but if you check out:
http://visualstudiomagazine.com/articles/2011/07/22/wcmob_visual-states.aspx
You'll see a simple example of switching between two UI components on a single page within a Windows Phone 7 PhoneApplicationPage. In your scenario, you'd use this paradigm to create 2 animation storyboards, one for showing an overlay control and one for settings the 'disabled' property on the main grid.