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
Register | FAQ | Members List | Calendar | 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 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 Display Modes
  #1 (permalink)  
Old March 26th, 2011, 01:11 AM
Registered User
 
Join Date: Mar 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch 3: Request for member 'tag' ERROR

I double checked the code against the book and the codes posted by other people on the forum but no matter what I did I always get the follow error code:

Request for member 'tag' in something not a structure or a union.

Please help.

H File:
Code:
//
//  UsingViewsViewController.h
//  UsingViews
//
//  Created by Van Dai on 3/25/11.
//  Copyright 2011 Dai Inc. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UsingViewsViewController : UIViewController {
	IBOutlet UIPageControl *pageControl;
	IBOutlet UIImageView *imageView1;
	IBOutlet UIImageView *imageView2;
	UIImage *tempImageView, *bgImageView;
}

@property (nonatomic, retain) UIPageControl *pageControl;
@property (nonatomic, retain) UIImageView *imageView1;
@property (nonatomic, retain) UIImageView *imageView2;

@end


M File:
Code:
//
//  UsingViewsViewController.m
//  UsingViews
//
//  Created by Van Dai on 3/25/11.
//  Copyright 2011 Dai Inc. All rights reserved.
//

#import "UsingViewsViewController.h"

@implementation UsingViewsViewController

@synthesize pageControl;
@synthesize imageView1, imageView2;



/*
// 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 {
	//---initialize the first imageview to display an image---
	[imageView1 setImage:[UIImage imageNamed:@"Ferrari-Logo-Photo.jpg"]];
	tempImageView = imageView2;
	
	//---make the first imageview visible 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 contorl's value is changed---
- (void) pageTurning: (UIPageControl *) pageController {
	//---get the page number you can turn to---
	NSInteger nextPage = [pageController currentPage];
	switch (nextPage) 
    {
		case 0:
			[tempImageView setImage:
			 [UIImage imageNamed:@"Ferrari-Logo-Photo.jpg"]];
			break;
		case 1:
			[tempImageView setImage:
			 [UIImage imageNamed:@"green_apple_logo.jpg"]];
			break;
		case 2:
			[tempImageView setImage:
			 [UIImage imageNamed:@"windows-logo.jpg"]];
			break;
		case 3:
			[tempImageView setImage:
			 [UIImage imageNamed:@"macbook pro.jpg"]];
			break;
		case 4:
			[tempImageView setImage:
			 [UIImage imageNamed:@"hp_logo.jpg"]];
			break;
		default:
			break;
	 }
            //---switch the two imageview views---
            if (tempImageView.tag == 0) {
                 tempImageView = imageView2;
                 bgImageView = imageView1;
             }
             else
             {
                 tempImageView = imageView1;
                 bgImageView = imageView2;
             }
             
             //---animate the two views flipping---
             [UIView beginAnimations:@"flipping view" context:nil];
             [UIView setAnimationduration:0.5];
             [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
             [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
                                    forView:tempImageView
                                      cache:YES];
             [tempImageView setHidden:YES];
             
             [UIView commitAnimations];
             
             [UIView beginAnimations:@"flippig view" context:nil];
             
             [UIView setAnimationDuration:0.5];
             [UIView setAnimationCurve::UIViewAnimationCurveEaseInOut];
             [setAnimationTransition:UIViewAnimationTransitionFlipFromRight
                             forView:bgImageView
                               cache:YES];
             
             [bgImageView setHidden:NO];
             
             [UIView commitAnimations];
             }
             
			 
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)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 {
    [pageControl release];
    [imageView1 release];
    [imageView2 release];
    [super dealloc];
}
             

- (void)alertView:(UIAlertView *)alertView
clickedButtonAtIndex:(NSInteger)buttonIndex {
	NSLog(@"%d", buttonIndex);
}


- (void)actionSheet:(UIActionSheet *)actionSheet
clickedButtonAtIndex:(NSInteger)buttonIndex{
	NSLog(@"%d", buttonIndex);
}

@end
Reply With Quote
  #2 (permalink)  
Old March 26th, 2011, 07:55 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: 297
Thanks: 1
Thanked 62 Times in 60 Posts
Default

The error is caused by a mistake in your @interface declaration
Code:
@interface UsingViewsViewController : UIViewController {
	IBOutlet UIPageControl *pageControl;
	IBOutlet UIImageView *imageView1;
	IBOutlet UIImageView *imageView2;
	UIImage *tempImageView, *bgImageView;
}
*tempImageView and *bgImageView are UIImageView not UIImage.

so it should be
Code:
@interface UsingViewsViewController : UIViewController {
	IBOutlet UIPageControl *pageControl;
	IBOutlet UIImageView *imageView1;
	IBOutlet UIImageView *imageView2;
	UIImageView *tempImageView, *bgImageView;
}
Assuming everything else is fine, that should solve your problem.
Bob
Reply With Quote
Reply


Thread Tools
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
VB Ver. 'Context' is not a member error ADH BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 August 20th, 2007 04:04 AM
complile error : method or data member not found! Tasha Access VBA 6 May 1st, 2007 03:49 PM
Compile Error data member not found alfiee Access VBA 1 July 7th, 2006 05:35 PM
Ch 13 p 484 missing <ResourceParams> opening tag JHvdSloot JSP Basics 0 October 2nd, 2003 07:35 AM
CH 9: A simple tag w/ attributes seeDerekNow JSP Basics 1 September 28th, 2003 11:20 PM



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


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