Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Beginning iOS 4 Application Development
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning iOS 4 Application Development
This is the forum to discuss the Wrox book Beginning iOS 4 Application Development by Wei-Meng Lee; ISBN: 978-0-470-91802-9
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning iOS 4 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 22nd, 2010, 04:31 PM
Registered User
 
Join Date: Dec 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 3 Using the Alert View

Please if someone can help me
I just start to learn IOS and I copy simple code and run the IOS Simulator and it show a blank screen, doesn't show the "Hello", "This is an alert view"

- (void)viewDidUnload {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Hello"
message:@"This is an alert view"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];

[alert show];
[alert release];
[super viewDidLoad];

}
Reply With Quote
  #2 (permalink)  
Old December 25th, 2010, 11:06 PM
Registered User
 
Join Date: Mar 2009
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Not viewDidUnload, but viewDidLoad

You should implement the code at viewDidLoad method, not viewDidUnload. :)
Reply With Quote
  #3 (permalink)  
Old December 26th, 2010, 09:37 PM
Registered User
 
Join Date: Dec 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thank you!!!

thank you for your help. I really appreciate
Reply With Quote
  #4 (permalink)  
Old February 6th, 2011, 12:40 AM
Registered User
 
Join Date: Feb 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Also getting blank.

I inserted the code on viewDidLoad, but like the person above still showing a blank screen.

------------


//
// UsingViewsViewController.m
// UsingViews
//
// Created by Dean on 2/5/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "UsingViewsViewController.h"

@implementation UsingViewsViewController




/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
*/

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/


/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Hello"
message:@"This is an alert view"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];

[alert show];
[alert release];
[super viewDidLoad];
}
*/


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIIn terfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];

// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}


- (void)dealloc {
[super dealloc];
}

@end
Reply With Quote
  #5 (permalink)  
Old February 6th, 2011, 12:40 PM
Registered User
 
Join Date: Feb 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i dont know if its related to my issue here, but im a noob at programming so bare with me. i noticed that when i typed the code under - (void) viewDidLoad
it is not automating the code or giving it color.it remained under green color text.is that mean that i have to convert it somehow?or the color change has nothing to do with how the code executes as long as you input it correctly?
Reply With Quote
  #6 (permalink)  
Old February 6th, 2011, 05:27 PM
Registered User
 
Join Date: Feb 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by milpitian View Post
I inserted the code on viewDidLoad, but like the person above still showing a blank screen.

Code:
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
 UIAlertView *alert = [[UIAlertView alloc]
 initWithTitle:@"Hello"
 message:@"This is an alert view"
 delegate:self
 cancelButtonTitle:@"OK"
 otherButtonTitles:nil];
 
 [alert show];
 [alert release];
 [super viewDidLoad];
}
*/
You need to remove the "/*" and "*/" surrounding viewDidLoad (highlighted in red). They mark the beginning & end of a comment block & cause the compiler to ignore everything in between. That also explains why the text was all green.
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
Chapter 4 ToDoList runs but no custom view? scottm BOOK: Professional Android 2 Application Development 8 June 21st, 2010 01:04 PM
Chapter 4 - Split View-Based App johnoeffinger BOOK: Beginning iPad Application Development 4 May 21st, 2010 05:43 PM
Chapter 4 - creating a view MarieMcKeeth BOOK: Beginning Ruby on Rails 1 March 21st, 2009 06:56 PM
Chapter 9 Alert Box pg. 305 Item 8 workib BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 May 28th, 2008 10:09 PM
Chapter 6: Templated Controls In Design View geomar BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 1 February 20th, 2007 12:23 PM



All times are GMT -4. The time now is 03:55 PM.


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