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 05-15-2010, 03:04 PM   #26 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 29
sn0w911 is on a distinguished road
Default

OMG! What a solution :P

Of course I already tried some ways. Even with NSString but no way works.

Do you maybe have some code for me?
sn0w911 is offline   Reply With Quote
Old 05-15-2010, 03:06 PM   #27 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 29
sn0w911 is on a distinguished road
Default

OMG! What a solution :P

Of course I already tried some ways. Even with NSString but no way works.

Do you maybe have some code for me?
sn0w911 is offline   Reply With Quote
Old 05-15-2010, 03:06 PM   #28 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Sure, here is some code:

What have you tried? Matt Legend Gemmell
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 05-15-2010, 03:14 PM   #29 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 29
sn0w911 is on a distinguished road
Default

Ok, you're right.

At the beginning my code worked with this: label.text = [textfield text];

This doesn't work.

Now I have: label = [NSString stringWithFormat:@"%@", textfield];

Does this go in the right way?
sn0w911 is offline   Reply With Quote
Old 05-15-2010, 03:15 PM   #30 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

First one looks right. In what way does it not work?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 05-15-2010, 03:20 PM   #31 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 29
sn0w911 is on a distinguished road
Default

I know it's right

It changes the label - from 0 to - So it does something and I have the feeling that the communication between the TextField and Label doens't work.

Code for the Textfield:

UIAlertView *dienst = [[UIAlertView alloc] initWithTitle:@"…" message:@"…?\n\n"
delegate:self cancelButtonTitle:@"…" otherButtonTitles:@"…", nil];
UITextField *text = [[UITextField alloc] init];
text.delegate = self;
text.opaque = YES;
text.borderStyle = UITextBorderStyleRoundedRect;
text.frame = CGRectMake(30, 90, 220, 25.0);
text.textAlignment = UITextAlignmentCenter;
text.keyboardType = UIKeyboardTypeNumberPad;
text.returnKeyType = UIReturnKeyDone;
[text becomeFirstResponder];
[dienst addSubview:text];
CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 130.0);
[dienst setTransform:myTransform];
[dienst show];
[dienst release];



text is the textfield.
sn0w911 is offline   Reply With Quote
Old 05-15-2010, 03:23 PM   #32 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

If that is all of the relevant code, you are leaking the text field.

Where do you attempt to grab the text from the text field?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 05-15-2010, 03:27 PM   #33 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 29
sn0w911 is on a distinguished road
Default

I need it because it's the 2nd biggest part of my app

How could I fix my leak?

Thank you for your help
sn0w911 is offline   Reply With Quote
Old 05-15-2010, 03:31 PM   #34 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Ahem.

Quote:
Originally Posted by BrianSlick View Post
If that is all of the relevant code, you are leaking the text field.

Where do you attempt to grab the text from the text field?

Release the text field when you release the alert.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 05-15-2010, 03:37 PM   #35 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 29
sn0w911 is on a distinguished road
Default

It's already releasing :-/

The label should be shown as soon as I touch the "Start" Button.
Already worked before.
sn0w911 is offline   Reply With Quote
Old 05-15-2010, 03:43 PM   #36 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Ok, I'm going to bail if you don't start providing useful answers.


The code that posted previously, that you said doesn't work... Where.are.you.doing.that?

Post more code, less descriptions of how your app works. I don't care about your app. The problem, and thus the solution, will be in your code.


And the text field is not "already releasing", whatever that means, unless you have [text release] there somewhere that you didn't show.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 05-18-2010, 10:30 AM   #37 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 29
sn0w911 is on a distinguished road
Default

Hey, okay, sorry for being so bad, I'm not doing this for a long time.

My App is little combination of different timers and ++/-- buttons. I want so set up a number in my AlertView / TextField. The number should be set after touching "ok" in my label.

I'm sorry, I already had [text release], just forgot this part of the code pasting here

I tried different ways and I think that it is a simple problem. Maybe the TextField doesn't get saved?

I tried this:

- (IBAction)button {
UIAlertView *dienst = [[UIAlertView alloc] initWithTitle:@"…" message:@"…\n\n"
delegate:self cancelButtonTitle:@"Abbrechen" otherButtonTitles:@"OK", nil];


UITextField *textfieldAlert = [[UITextField alloc] init];
textfieldAlert.delegate = self;
textfieldAlert.opaque = YES;
textfieldAlert.borderStyle = UITextBorderStyleRoundedRect;
textfieldAlert.frame = CGRectMake(30, 90, 220, 25.0);
textfieldAlert.textAlignment = UITextAlignmentCenter;
textfieldAlert.keyboardType = UIKeyboardTypeNumberPad;
textfieldAlert.returnKeyType = UIReturnKeyDone;
[textfieldAlert becomeFirstResponder];
[dienst addSubview:textfieldAlert];
[textfieldAlert release];
CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 130.0);
[dienst setTransform:myTransform];
[dienst show];
[dienst release];
}

- (void) alertViewUIAlertView *)dienst clickedButtonAtIndexNSInteger)buttonIndex {

if (buttonIndex == 1) {

self.string = textfieldAlert.text;

NSString *labelString = string;

labelString = [[NSString alloc] initWithFormat:@"%@", string];

label = labelString;
[labelString release];
[textfieldAlert release];


}
}



This should normally work? :O
But it shows me in my Label: (null)

Is there anything wrong?
If you need more details just write it.

Thank you for your help.
sn0w911 is offline   Reply With Quote
Old 05-18-2010, 10:39 AM   #38 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

You have warnings in Xcode when you do that, right? Even before you run the app?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 05-18-2010, 10:40 AM   #39 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 29
sn0w911 is on a distinguished road
Default

OMG!
I solved it. It was so easy. I found it at a german Tutorial for beginners -> Hello World App

It's:

- (BOOL)textFieldShouldReturnUITextField *)textfieldAlert {

[textfieldAlert resignFirstResponder];

return YES;

}

- (void)textFieldDidEndEditingUITextField *)textfieldAlert {

verdienst.text = textfieldAlert.text;

}

For everyone who should have this problem in the future. Thanks to everyone who tried to help
sn0w911 is offline   Reply With Quote
Old 11-11-2010, 04:24 PM   #40 (permalink)
mmm
Registered Member
 
Join Date: Nov 2010
Posts: 1
mmm is on a distinguished road
Default UIAlertView with text field - resignFirstResponder doesn't dismiss keyboard

I use similar code to display a password prompt (UIAlertView with UITextField). Starting with IOS 4.0, it seems resignFirstResponder doesn't dismiss the keyboard anymore. Has anyone else noticed this problem?
mmm is offline   Reply With Quote
Reply

Bookmarks

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: 343
14 members and 329 guests
akacaj, alexP, ClerurcifeDer, Duncan C, givensur, glenn_sayers, GraffitiCircus, guusleijsten, JmayLive, NetGuru, Paul Slocum, Punkjumper, Sloshmonster, yys
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,114
Posts: 402,883
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

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