Xcode Meanings. "window" - iphone

Hello StackOverflow people :)
I have a simple question regarding Xcode (cocoa) "Apple application maker"
Q : What is the name for the transition between 2 windows?
and do I make another "file" in the resources to make another window?
Thanks!
any extra details is appreciated

The transitions are just animations most of the time, but we can add in extra effects like fading and flipping depending on the type of the new window/view that we want to load. Within Xcode, the terminology to view and see a new window is called a "push" - as you push it onto the view hierarchy. To close it, you "pop" it off the stack.
And yes, you simply make a new file and then choose it's type to make another window - depends on exactly which type you are after, whether it's a code file or interface file etc.
Hope this helps.

Related

How to check which class/UIViewController is executing while testing on device on Xcode?

Recently I have been working on an old swift project built in back in 2015. Its really difficult to find which ViewController is executing currently because of the naming convention, usage of really massive storyboard(I feel terrified to even go to the main.storyboard) and various reason like usage of different language. Of course I can find it but it takes long. I was thinking if there is any way like when I run the project on a device and navigate to different page is there any way to see in the console which ViewController is executing ?
There is a quick way to find what view controller you are on when you are running your app.
1) Launch your app on the device or simulator.
2) Go into Xcode and tap this button:
3) This will open the Debug View Hierarchy. Click on the phone and you will see all the elements in the top bar. You can also see a hierarchy on the left-hand side. In here, you can click down and you will see the name of the view controller on screen.
Using the debugger after putting a breakpoint where you prefer you can write this and press return.
Swift 4.x
po UIApplication.shared.keyWindow?.rootViewController?.value(forKey: "_printHierarchy")
This method is a private API, thus you cannot use on production code, just use it in debug or from the debugger console.
I think it is better to see in debug area for your current viewcontroller named self, you get all information from there open the dropdown and and see you need to put break point in your viewController init method or where you want to debug, However you want to know programatically which is you current viewController you can get it by
appDelegate.window.currentViewController()
If you need which ViewController is Pushed or presented you can get from the above code but the case will be different if you are using the Slidemenu controller, I mean it is totally depends on how you have started navigation and which navigation controller is currently is use.
Can you briefly describe why you need current ViewController so i can help you further.

How come Xcode Stops letting me hook up IBOutlets after two Interface Controllers?

I was setting the IBOutlets for the first few objects of a Watch App.
However, after doing a few IBOutlets it stops once I get to work on the third InterfaceController, closes InterfaceController.Swift, and instead opens WKInterfaceController.h. It does this every time I try to add the label or button to the code.
Why is this? Should I be approaching this code differently if I'm trying to build a hierarchical program?
Thank you!
This is what I want, where I can add in the outlets...
But after a few outlets, it automatically opens this page and doesn't let me add anymore...
Do you mean the right-hand side of the split view showing the code doesn't load the correct class?
If so, it's probably the reasonably common issue of Xcode not automatically knowing which class to load.
You can select the class you want to show manually by clicking in the toolbar above the code (i.e. the "two circles" in the second screenshot right above the code), and selecting the correct file

iPhone Beginner Question - Hooking Up Actions

I'm just starting out with iPhone development, and in my hello world application I'm having a hard time hooking up a view to a controller with actions. I followed the instructions in the book I'm reading (I believe), but depending on where I run the application the app behaves differently.
-When i command-r from the code, I see only the single button I have on the view taking up the whole window. When I click the button the action is triggered.
-when I command-r from the interface designer I see the button, label, and textbox lined up correctly. When I click the button nothing happens.
Anyone know why this is happening/how to fix it? Thanks.
Launching simulator from interface builder only simulates selected .xib file. You should only do that to test your view design.
If you want to learn the basics about iPhone development I recommend:
NewBoston: http://www.thenewboston.com/?cat=34&pOpen=tutorial
Stanford: http://itunes.stanford.edu/
both are free video tutorials on how to make iPhone apps.
Good luck!
you accidentally the whole view.
Seriously. You made one wrong connection. You connected the view outlet of the viewController (aka File's Owner) with the UIButton.
just delete this connection and connect the view outlet of the File Owner with the "Root"View.
And you should probably remove almost all connections that trigger btnClicked: too. TouchUpInside from the button is enough.
And you should follow the objective-c coding style (Part II) and start all Class names with a capital letter. chapter_2ViewController should be something like Chapter2ViewController.
To my knowledge you cannot run an app from interface builder, I may be mistaken.
You should make sure your interface builder file is saved and run the app from within xcode
just a guess, but is the window size in the simulator different than that in IB? You might check the control resizing masks and on the sizing tab in IB.

how to close a method/function on iPhone xCode?

when your project is getting bigger and bigger we have to look for ways to make it more easy to read.
The point is, I want to close all my functions using any key short code in my Xcode, let see the picture attached to understand what I mean:
(I cannot set any picture becuase I need more reputation...)
Well I mean:
> - (void) process1 {
}
If we press on the row on top left, the process will get closed. How can I use a key short code to close all my functions/methods on my class (.m)?
Thank you!
Check the View→Code Folding menu for options and hot-keys.
I'm pretty sure it's here. You'll also find other cool stuff
Hidden Features of Xcode

Is it possible to turn a View-Based App into a navigation-Based App?

I am close to finishing my first application (a UITableView style one) on the iphone but have realised it will look much better, and stand a far better chance of getting through the approval process, if it is presented as a navigation-based app rather than a view-based one - in hindsight my initial choice is not really suitable...
Is it possible for me to somehow change easily the application into a new type, or would i be better starting again from scratch with all the hassle that would entail...
thanks for any advice on how it may be done,
karl
It wouldn't be particularly difficult to shift the means of interaction to a navigation controller from a simple view controller (it also isn't difficult to go the reverse direction). Although, there isn't anything as simple as a tutorial on how to do it or menu item you can select. You could look at the plumbing generated by Apple's template for a navigation based application and add the necessary glue to your app delegate. Once that is in place you could simply push your view based applications view controller onto the navigation stack. If you have more specific questions or are stuck somewhere in particular we can help to get you un-stuck if you provide details about where you are running into issues.
As an aside, I doubt your application will be rejected solely for being view based vs. navigation based.
Hmmmmm, for soem reason t wont let me add anything to comment on your post!
Anyway, i guess this is as good as anything here...
Ive been messing for the last hour or so and have managed to integrate my old code/data etc into a new navigation one without too many problems, in fact it looks nicer with a title bar at the top!
(I do like to try and work stuff out for myself so its a good learning curve!)
I am still struggling in that although the new view opens up i am
struggling to use a string from the first view (I have a UITableview table in there, i select a row and get a correct value from it which i currently check via an alert message) in the second view.
for some reason i do not get a title bar and 'back' button in the 2nd view so i guess it is not being put on the stack correctly (I have put a quick 'return' button in the view for testing purposes so i can navigate backwards and forwards).
Still, Im about 100% further on than i was earlier!
cheers for the reply,
Karl