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 07-17-2011, 12:16 AM   #1 (permalink)
Registered Member
 
roberthuttinger's Avatar
 
Join Date: Sep 2008
Posts: 96
roberthuttinger is on a distinguished road
Default Set UITextField from NSArray

I have tried many variations with no luck. I can NSLog the array and I get this:
HTML Code:
2011-07-17 00:54:54.886 Widgets[13444:207] <Widget: 0x5e2aad0> (entity: Widget; id: 0x5e0d8e0 <x-coredata://E64A0BCE-2344-4EE1-89CC-164ACD8995D6/Recipe/p115> ; data: {
    success = 1;
    coconutscarried = nil;
    name = "African Swallow";
    uidnumber = "105 ";
})
How can I simple set a text field?

Pardon the mess but this is an assortment of code I have tried (messy). The array and text field have been set up in .h/m and bound in IB
Code:
- (void)viewDidLoad {
    [super viewDidLoad];
	//NSLog(@"%@",[[swallowArray name] text]); // doesnt work
	//NSLog(@"The string at index is %@.", [self.swallowArray objectAtIndex:0]);//nope...
	for (int i = 0; i < [swallowArray count]; i++) {
		//nameTextField.text = [[swallowArray objectAtIndex:i] uidnumber];
		//NSLog(@"%@",swallowArray.name);
	//}
	//nameTextField.text = [[swallowArray objectAtIndex:0] uidnumber];
	//NSString* strRate = [[swallowArray object] uidnumber];
	nameTextField.text = [nameTextField.text stringByAppendingString:[NSString localizedStringWithFormat:@", %@", [[swallowArray objectAtIndex:i] name]]];

}
and many more. This has got to be dead simple, but I am kind of a noob.

thanks!

bo
roberthuttinger is offline   Reply With Quote
Old 07-17-2011, 12:25 AM   #2 (permalink)
Registered Member
 
roberthuttinger's Avatar
 
Join Date: Sep 2008
Posts: 96
roberthuttinger is on a distinguished road
Default ..after hours of searching, i find the answer 5 min after posting

ANSWER:
Code:
NSString *nameFromArray = [NSString stringWithFormat:@"%@", [eventArray valueForKey:@"name"]];
		NSLog(@"%@", nameFromArray);
Quote:
Originally Posted by roberthuttinger View Post
I have tried many variations with no luck. I can NSLog the array and I get this:
HTML Code:
2011-07-17 00:54:54.886 Widgets[13444:207] <Widget: 0x5e2aad0> (entity: Widget; id: 0x5e0d8e0 <x-coredata://E64A0BCE-2344-4EE1-89CC-164ACD8995D6/Recipe/p115> ; data: {
    success = 1;
    coconutscarried = nil;
    name = "African Swallow";
    uidnumber = "105 ";
})
How can I simple set a text field?

Pardon the mess but this is an assortment of code I have tried (messy). The array and text field have been set up in .h/m and bound in IB
Code:
- (void)viewDidLoad {
    [super viewDidLoad];
	//NSLog(@"%@",[[swallowArray name] text]); // doesnt work
	//NSLog(@"The string at index is %@.", [self.swallowArray objectAtIndex:0]);//nope...
	for (int i = 0; i < [swallowArray count]; i++) {
		//nameTextField.text = [[swallowArray objectAtIndex:i] uidnumber];
		//NSLog(@"%@",swallowArray.name);
	//}
	//nameTextField.text = [[swallowArray objectAtIndex:0] uidnumber];
	//NSString* strRate = [[swallowArray object] uidnumber];
	nameTextField.text = [nameTextField.text stringByAppendingString:[NSString localizedStringWithFormat:@", %@", [[swallowArray objectAtIndex:i] name]]];

}
and many more. This has got to be dead simple, but I am kind of a noob.

thanks!

bo
roberthuttinger is offline   Reply With Quote
Reply

Bookmarks

Tags
nsarray, nslog, objectatindex, uitexfield

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: 403
16 members and 387 guests
blasterbr, buggen, Clouds, dre, EvilElf, HemiMG, jeroenkeij, jimmyon122, jonathandeknudt, LEARN2MAKE, Mah6447, n00b, nyoe, pungs, Sami Gh, stanny
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,668
Threads: 94,121
Posts: 402,900
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jonathandeknudt
Powered by vBadvanced CMPS v3.1.0

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