Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-29-2010, 07:46 AM   #1 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 6
Toliver182 is on a distinguished road
Default TabBar Applications, Buttons and Labels in FirstView

Hi All

I have a TabBar applications and one of the tab items is called Newsletter.

I want to programmatically change a label in the NewsletterView.


Here is my header file for the view:


Code:
//
//  NewsletterViewController.h

#import <UIKit/UIKit.h>


@interface NewsletterViewController : UIViewController {
	IBOutlet UILabel *myLabel;

}
@property (nonatomic, retain) IBOutlet UILabel *myLabel;

@end

and here is my implementation:

Code:
//NewsletterViewController.m

#import "NewsletterViewController.h"


@implementation NewsletterViewController
@synthesize myLabel;

/*
// 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) {
		
    }
    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 {
    [super viewDidLoad];
	myLabel.text = @"test";
}


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

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

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


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

@end
In interface builder I opened NewsletterViewController.xib and have added a UILabel.

It would not allow my to connect this to "myLabel" so i added an object and made is a class of NewsletterViewController, this allowed me to connect the UILabel to the myLabel outlet.

I have used the code to change the text, but this doesn't do anything.

Code:
- (void)viewDidLoad {
    [super viewDidLoad];
	myLabel.text = @"test";
}
Everything compiles cleanly.


Can you offer any advice, am i linking the Label correctly? should my label be in my delegate?


Thanks
Toliver182 is offline   Reply With Quote
Reply

Bookmarks

Tags
linking, tabbar, uilabel

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 374
7 members and 367 guests
daudrizek, HemiMG, Kirkout, MarkC, Sami Gh, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,665
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, daudrizek
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:48 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0