Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning iPad Application Development
This is the forum to discuss the Wrox book Beginning iPad Application Development by Wei-Meng Lee; ISBN: 9780470641651
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning iPad Application Development section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 21st, 2010, 03:17 PM
Registered User
 
Join Date: Jul 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default hello world! help :(

I'm brand new to this and do not know Objective -C or any programing language for that matter. I don't know what I'm doing wrong I do everything it says on page 38 but I cannot get the pop up to show itself when the simulator is ran. Here is what I have entered:


#import "HelloWorld2ViewController.h"

@implementation HelloWorld2ViewController

-(IBAction) btnClicked:(id) sender {
//---display an alert view---
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello World!"
message:@"iPad, here I come!"
delegate:self
cancelButtonTitle:@"ok"
otherButtonTitles:nil];
[alert show];
[alert release];
}


Thanks for your help!!!
Reply With Quote
  #2 (permalink)  
Old July 22nd, 2010, 08:01 AM
Registered User
 
Join Date: Jul 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you link the button on the View to the btnClicked action in your code as described at the top of page 38?
Control click the button (from Interface Builder) and drag to the File Owner. Choose btnClicked in the window that pops up.
Reply With Quote
  #3 (permalink)  
Old July 22nd, 2010, 11:58 AM
Registered User
 
Join Date: Jul 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I did. is there a reason so much stuff is showing up in red?
Reply With Quote
  #4 (permalink)  
Old July 27th, 2010, 12:18 AM
Registered User
 
Join Date: Jul 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I believe you are referring to the red characters in your source code. The default for syntax highlighting is to put strings in red. You can customize this from the fonts & colors section in preferences.

Were you able to get your code working?
Reply With Quote
  #5 (permalink)  
Old July 27th, 2010, 01:20 AM
Registered User
 
Join Date: Jul 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No, I haven't honestly I've been hoping for a little more help on here. Thanks for the info though! I thought maybe red meant there was an error.
Reply With Quote
  #6 (permalink)  
Old July 27th, 2010, 01:45 AM
Registered User
 
Join Date: Jul 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How are you launching the simulator for testing?

If you launch it from Interface Builder then your code will not be executed, which means the alert will not pop when you touch the button.

You need to launch it from Xcode to get your code to run in the simulator.
Reply With Quote
  #7 (permalink)  
Old August 23rd, 2010, 11:53 AM
Registered User
 
Join Date: Aug 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi,
I am also new to this coming from PC World.
When I do Control-click the round Rect Button and drag it to the File's Owner item,
there is only a windows with Outlet and Delegate coming up and no btnClicked action.
What did I do wrong?
Appreciate your help. Thanks!

Rick
Reply With Quote
  #8 (permalink)  
Old August 23rd, 2010, 12:00 PM
Registered User
 
Join Date: Aug 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

OK now. found my problem. typo in the line. Thanks anyway.
Reply With Quote
  #9 (permalink)  
Old August 23rd, 2010, 12:43 PM
Registered User
 
Join Date: Aug 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Not getting very far for this, I also cannot get the pop up when I click on the simulator.
Look at the .m file, I got the following warning:

warning: no '-initWithTitle:message:deletegate:cancelButtonTitle :otherButtonTitles:' method found

Help please. Thx.
Reply With Quote
  #10 (permalink)  
Old August 24th, 2010, 11:47 AM
Friend of Wrox
Points: 1,671, Level: 16
Points: 1,671, Level: 16 Points: 1,671, Level: 16 Points: 1,671, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
Default

Is the warning that you posted exactly what appears?
If so, two things are apparent. First, delegate is spelled incorrectly, and 2nd the "destructiveButtonTitle:" argument is missing. This will generate the warning since it is not a legitimate method.
As often as possible use the autocomplete feature in Xcode, since this will eliminate typing errors and will only provide completions for valid methods.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How many VS developers are there all over the world? Trinominal Visual Studio 2008 3 April 23rd, 2009 01:02 PM
Hello World Example Chapter 1 goboomer BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 12 January 14th, 2009 10:07 PM
ASP "Hello World" Bill_Thompson ASP.NET 2.0 Basics 3 December 14th, 2007 09:38 AM



All times are GMT -4. The time now is 08:04 AM.


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