I'm quite new to iOS Programming. I've done Objective-C for about a year, and now I want to start making apps for the iPhone. I think I'm missing out on something really simple, though. What I've done is this:
First I created a new Single View Application with TestApp as a product name. I enabled Use Storyboards, Use Automatic Reference Counting and Include Unit Tests. After creating the project, I dragged a UIButton onto the View in the storyboard file.
Note that I didn't write a single line of code. I launched my app in the iPhone Simulator and pressed the button, but it's not responding. I know I didn't assign an action to the press of the button, but the gradient of the button isn't changing, as I know it should. The User Interaction Enabled properties of both my view and my button were enabled.
Recently, I've created a few apps in Xcode that worked just fine, but I didn't use storyboards in those projects. Thus, I'm guessing there's something extra to do when using storyboards of which I'm just unaware. I'm using Xcode 4.5 and the iPhone 6.0 Simulator.
I wrote NSLog(#"View was loaded."); statement in the viewDidLoad method of my ViewController to make sure this view controller was actually loaded. (I know my button wouldn't show up if it was the wrong view controller, but I did this just to make sure.)
I also wrote a changeTitle: method in my ViewController to change the title of my button to New Title after it was pressed, just in case the button worked but its gradient just wouldn't respond to a tap. I linked this IBAction to my button, but it wasn't called.
In my ViewController, I created an IBOutlet of a UIButton which I connected to my button. In the viewDidLoad method of my ViewController, I changed the title of my button to New Title, this actually worked. The title of my button changed to this new title when launching my app in the iOS Simulator. The button itself still wasn't responding, though.
As a last try, I also wrote [button setEnabled:YES]; in my ViewController's viewDidLoad method, but this didn't help. My button still doesn't respond to any tap. What am I missing out on?
This is weird. I had an issue with my printer, so I restarted my computer. After this, this issue was suddenly solved as well (just like my printer issue). I'm not sure how this could have affected anything, but I'm glad it works again!
Ran into the same issue.
Apparently Content Reseting the Simulator worked for me
Very strange this..
Related
Forgive but I haven't coded in about a year or two, so I haven't been following the latest update in Xcode.
Anyways, I decided to go back and brush up on some skills and I noticed right off the bat that a lot has changed.
I created a new project using the tabbed view controller set up, usually it shows in storyboard immediately upon creating the project. Now there is nothing there. Where did it go and how do I bring it back?
I attached a screenshot so you can see the simulator running the tabbed apps but not showing in storyboard.
enter image description here
You opened the LaunchScreen.storyboard. This layout appears on the screen for a few moments while the app is launching.
https://developer.apple.com/documentation/uikit/app_and_environment/responding_to_the_launch_of_your_app
https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/launch-screen
The storyboard that you are looking for is Main.storyboard
Notice, that there is no Main.storyboard if you start with SwiftUI
There are no specialized app templates any more. But there is still a tab view controller object in the storyboard editor's library, so just drag it into the canvas and use it. It gives you same two-child tab view controller as before.
I am having a very strange problem.
I have a tableView, which when the cell is clicked it segues to the next VC, sending the data from that cell with it via prepareForSegue function. From the next VC I then segue from there to another VC (again passing the data needed via prepareForSegue). The final VC is a chat style VC, so it contains a scrollView and a textView, the three VCs look like so:
In the chatViewController I have set up a Parse backend so it queries the data and then places inside the scrollView like so:
The problem I am having is that the keyboard does not pop open. I know the code is CORRECT! As it pops open when I make the chatViewController the initial VC. it just doesn't work when it is segued to from multiple VC.
Does anybody have any ideas on this or ever had any problems with segueing into a scrollViewController. I've tried everything I can think off.
Thanks in advance.
If you're on ios simulator, the software keyboard may be turned off. For actual emulation you may try a ios phone instead of simulator.
If you wanna appear the soft-keypad in simulator try following
solution
iOS Simulator -> Hardware -> Keyboard
Uncheck "Connect Hardware Keyboard"
Mine was checked because I was using my mac keyboard, but if you make sure it is unchecked the iPhone keyboard will always come up.
solution is actually copied from here
I do all my work on a 13" macbook and there are times when I need to send the designer screenshots of the ViewController I'm working on. Usually I have to take multiple screenshots but I was wondering if anyone knows of an app or a way to do it from Xcode.
Would it be an option to send a screenshot from the simulator? You could run your app, navigate to your ViewController and presse Cmd + S to save a screenshot on your desktop. Here it doesn't matter if the simulator is bigger than your screen, the screenshot will always show the whole ViewController.
I've set up a UIBarButtonItem in IB, created the IBAction by dragging from IB to the header file, then just put a simple breakpoint within the action in my source file....... and nothing happens.
I'm using AVCam. I can run the action from a button, but it needs to be done on a toolbar because I'm working with sharekit. I've made toolbars before, and have never had this problem before.
I connected both the toolbar and the barbutton's objects... those both work. I can hide and unhide them freely, but for some reason I just cannot get the action to call.
Anybody got any ideas?
I had a very similar problem with an UIBarButtonItem with outlets not working in Xcode 4.5 - no actions got send when I pushed the button, and the referencing outlet didn't reference to anything.
After some time and googling, I discovered that even more none of all the changes I made to my storyboard did have any effect, but hardcoding the GUI worked.
Finally, emptying Xcode project caches solved my problem - the description how to do this can be found here: How to Empty Caches and Clean All Targets Xcode 4
I had the same problem with Jeff.
For a long time, i tried lots of useless stuff.
Adding selectors programatically , bla bla bla
i also had an UITapGestureRecognizer added on viewDidLoad in order to dismiss keypad.
it was not letting gestures to reach UIView.
Not to UIBarButtonItem Click Event and many more
Not to UITableViewCell Select Event.
This solved my problem:
tap.cancelsTouchesInView=NO;
All of a sudden
UITableViewCell Select started to work
UIBarButtonItem Click event started to work.
My problem was occurring only (7.1)
Not in (8.1)
This is really bugging me to the point where I'm going to have to step away for a bit.
So I am coding away and decide to change which ViewController gets launched on startup. I go into the app delegate and make the changes so that the the new ViewController will get loaded on startup, but when I run it in the simulator, the old one appears.
I've cleaned out the simulator, and i've tried "touching" files to force a relinking of the resources and it doesn't seem to make a difference. I can get an error to happen when I change the name of the ViewController in the app delegate to something like "vc". I then get a linking error saying the key value pair isn't found.
Anyways, if I am trying to just change which viewcontroller starts up in the app delegate, is there anything other than coding changes that I need to look at to inform xcode that I'm doing this? I've been searching google and working on this for the last couple hours and not really making any progress. If it makes any difference, this is for an ipad app.
Did you connect the controller IBOutlet of the app delegate with the your view controller?
Check your main XIB file in InterfaceBuilder.
And of course don't forget to save your changes made in InterfaceBuilder before launching the app since there is no "auto-save".