 |
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
|
|
|
|

January 17th, 2011, 08:30 PM
|
|
Registered User
|
|
Join Date: Jan 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Error in Image View "dealloc" undeclared
This is probably an obvious question but I don't know what it mean for something to be undeclared. Xcode didn't see any errors in my Image view project until I reached the below code. It tells me that dealloc is undeclared and expected ' ' before '{' token, but the book doesn't have this in the code. Please help.
}
- (void)dealloc {
[pageControl release];
[imageView1 release];
[imageView2 release];
[super dealloc];
}
|
|

January 18th, 2011, 12:14 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
|
|
The error is earlier in the file. You will need to include more before it can be pinpointed. Copy and paste the entire .m file into a reply, and it should be easy to track down.
Bob
|
|

January 19th, 2011, 09:38 PM
|
|
Registered User
|
|
Join Date: Jan 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Bob. Here is the code I left out. The image names are from my own images. I assumed this is what I was supposed to do.
//
// UsingViewsViewController.m
// UsingViews
//
// Created by Family on 1/15/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "UsingViewsViewController.h"
@implementation UsingViewsViewController
@synthesize pageControl;
@synthesize imageView1, imageView2;
- (void)viewDidLoad {
//---initialize the first imageview to display an image---
[imageView1 setImage:[UIImage imageNamed:@"images-2.jpeg"]];
tempImageView = imageView2;
//---make the first imageview viible and hide the second---
[imageView1 setHidden:NO];
[imageView2 setHidden:YES];
//---add the event handler for the page control---
[pageControl addTarget:self
action:@selector(pageTurning:)
forControlEvents:UIControlEventValueChanged];
[super viewDidLoad];
}
//---when the page control's value is changed---
- (void) pageTurning: (UIPageControl *) pageController {
//---get the page number you can turning to---
NSInteger nextPage = [pageController currentPage];
switch (nextPage) {
case 0:
[tempImageView setImage:
[UIImage imageNamed:@"images-2.jpeg"]];
break;
case 1:
[tempImageView setImage:
[UIImage imageNamed:@"images-1.jpeg"]];
break;
case 2:
[tempImageView setImage:
[UIImage imageNamed:@"images.jpeg"]];
break;
case 3:
[tempImageView setImage:
[UIImage imageNamed:@"Unknown.jpeg"]];
break;
case 4:
[tempImageView setImage:
[UIImage imageNamed:@"biglogo.jpeg"]];
break;
default:
break;
}
//---switch the two imageview views---
if (tempImageView.tag == 0) { //---imageView1---
tempImageView = imageView2;
bgImageView = imageView1;
}
else { //---imageView2---
tempImageView = imageView1;
bgImageView = imageView2;
}
{
//---animate the two views flipping---
[UIView beginAnimations:@"flipping view" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFl ipFromLeft
forView:tempImageView
cache:YES];
[tempImageView setHidden:YES];
[UIView commitAnimations];
[UIView beginAnimations:@"flipping view" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFl ipFromRight
forView:bgImageView
cache:YES];
[bgImageView setHidden:NO];
[UIView commitAnimations];
}
- (void)dealloc {
[pageControl release];
[imageView1 release];
[imageView2 release];
[super dealloc];
}
@end
|
|

January 20th, 2011, 12:13 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
|
|
You are short a closing } after [UIView commitAnimations];
|
|

January 20th, 2011, 12:50 AM
|
|
Registered User
|
|
Join Date: Jan 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
THANK YOU, Bob! It works like a charm 
|
|

September 17th, 2011, 01:12 AM
|
|
Registered User
|
|
Join Date: Sep 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
dealloc undeclare (first use in this function)
I have a the same error, below the details, thanks Guys!! really appreciate your help
//
// JUMPYViewController.m
// JUMPY
//
// Created by Jairo Rojas on 16/09/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "JUMPYViewController.h"
@implementation JUMPYViewController
@synthesize background, exercise_ball_blue, plataforma1, plataforma2, plataforma3, plataforma4, plataforma5;
- (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.
}
#pragma mark - View lifecycle
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad];
}
*/
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
self. background = nil;
self. exercise_ball_blue = nil;
self. plataforma1 = nil;
self. plataforma2 = nil;
self. plataforma3 = nil;
self. plataforma4 = nil;
self. plataforma5 = nil;
}
- (void)dealloc {
[super dealloc];
[background release];
[exercise_ball_blue release];
[plataforma1 release];
[plataforma2 release];
[plataforma3 release];
[plataforma4 release];
[plataforma5 release];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIIn terfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
|
|

September 18th, 2011, 08:15 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
|
|
If you send your nonworking project to
[email protected]
I should be able to to sort everything out. There are some issues with the code you pasted into the forum that are probably the result of the a bug in the way the forum presents code (I know when I have posted code in in the past that I have had to be watchful for artifacts appearing on the forum that do not exist in my actual code, e.g. extra spaces that result in incorrect syntax for example). These issues may be masking the actual cause of your problem. So an accurate version will be easier to diagnose from.
Bob
|
|

September 18th, 2011, 09:47 PM
|
|
Registered User
|
|
Join Date: Sep 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks a lot, I figure that issue, but sadly I still have one going on. I will send you the details by email. Thanks !!!
|
|
 |
|