p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning iOS Programming: Building and Deploying iOS Applications (http://p2p.wrox.com/forumdisplay.php?f=767)
-   -   Keyboard doesn't disappear (http://p2p.wrox.com/showthread.php?t=93596)

new2xcode September 22nd, 2014 05:13 AM

Keyboard doesn't disappear
 
I've been working through the tutorial but at Chapter 4 ("Adding a UITextField") page 82-3, I've ground to a halt. When I test the app, I can enter into the textfield but clicking RETURN does nothing. I did a trace and it does complete textFieldShouldReturn. I've gone over my code and it seems to be as stipulated (including errata) so I can't see the problem.

new2xcode September 23rd, 2014 05:10 AM

Keyboard doesn't disappear
 
OK, while awaiting a response, I decided to repeat the exercise from the start and this time it was different - now the keyboard doesn't appear when I click on the UITextField!

Also, I'm a little confused by the instructions on page 81 "Adding a UITextField"(remember I'm VERY new to Xcode!) - is point 5 an expansion of point 4 or an additional instruction? I took it as the former but I just wanted to check.

Hello, hello...anyone out there?

OrangeLady October 13th, 2014 12:52 AM

Chpt - 4 A Fix to Keyboard Won't disappear pgs 82-83
 
A more efficient way to set the Delegate for the UITextField and let the delegate act on behalf of the UITextField and dismiss the keyboard when the Return key is pressed...

To set the delegate, open the Main.storyboard and select the UITextField at the top, press the Control key and drag a line using the left mouse button to the View Controller (Yellow Orb) at bottom of screen. Release mouse button and Popover appears. Select the Delegate in the Outlets section.

Note: Make sure textFieldShouldReturn: method is included and the corrections are made from the Errata page on Wrox.com/go/begiosprogramming for chpt 4 in steps 9 and 10.

Next, with the UITextField selected, go to the Attribute Inspector and for the Return Key property, select Done. Then run the application.

This should work.

new2xcode October 14th, 2014 11:19 PM

OrangeLady, thank you and that feature is now working.

new2xcode October 15th, 2014 12:32 AM

So, I went on and added the Save button (p85) and at step 9, I run the app but when I click on the grey text view field, the save button doesn't appear. I've gone back and checked my code several times and it all seems as per the instructions - frustrating!

I even added an NSLog trace to textViewShouldBeginEditing method after "self.saveNotesButton.enabled = YES;" and that shows in the console, so the code is being executed.

I'm still puzzled as to how the button I added and labelled as "Save" became equated with the saveNotesButton identifier.

OrangeLady October 15th, 2014 10:22 PM

Page 85 - Save Button Won't Display
 
Try on page 86 after Step 8, Select the Save button. Go to the Attributes Inspector.

Ctrl Drag left mouse button from "Touch Up Inside" under Sent Event to the Save Button. I also change the text color and Shadow Color in Attribute Inspector to Light Grey. With the Save button selected check the Connection Inspector and you will see two connections, an IB Outlet and IB Action.

This will make the Save button work.

Thanks

new2xcode October 16th, 2014 01:29 AM

OrangeLady, perhaps we are on different versions of xcode (I'm on 6.0.1). I say that because the attributes inspector doesn't seem to show sent events. They are under the connections inspector and it shows the sent event "touch up inside" as view controller saveNotesButtonTouched and "referencing outlet" as saveNotesButton view controller. I don't know which inspector shows IB Outlet and IB Action. Right-clicking on the Save button also shows the connections inspector info.

OrangeLady October 16th, 2014 09:28 AM

Page 85 - Save Button Won't Display
 
New2xcode, Yes to follow along in the book you need to be on Xcode 5. I was experiencing the same problems you had.

So I went to www.developer.apple.com to download the previous version of Xcode 5.1/SDK 7.1 (note: this version supports iPhone 4 whereas Xcode 6 support iPhone 4s and not iPhone 4) and saved to a different folder name e.g. Xcode 5.1.

So now I have both versions of Xcode on my system. Then start these exercises over again with Xcode 5 and it will work.

Thanks.

new2xcode October 16th, 2014 07:25 PM

OrangeLady: that makes sense and I'll organise it as soon
as I return to civilisation and a reliable internet connection.
Many thanks!


All times are GMT -4. The time now is 07:56 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.