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-17-2011, 09:29 AM   #1 (permalink)
Registered Member
 
TrueScot's Avatar
 
Join Date: Oct 2009
Posts: 48
TrueScot is on a distinguished road
Default UITextField crashes when .hidden=NO;

When I use a UITextField to get input for placement in a UIPickerView it works fine unless I select a row in the pickerview first. The UITextField is hidden and a button needs to be pressed to unhide it to allow the user to enter something. If the user simply presses the button the UITextfield is unhidden with hidden=NO, and the field and keyboard appears, gets the input and puts it into the pickerview and hides the keyboard again without any problem. However, if I scroll through the pickerview first, then hit the button to input to the UITextField, the app crashes at the UITextField.hidden=NO; statement with the message -

'[NSCFString setHidden:] unrecognised selector sent to instance'.

It only happens when the pickerview has been used first ie. when the UITextField is not empty. I've tried to initialize the UITextField in the IBAction before getting the input but it makes no difference.

Any suggestions would be very helpful. Thanks.
TrueScot is offline   Reply With Quote
Old 05-17-2011, 09:31 AM   #2 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

Post how/where you are creating the textfield and how/where you are hiding it.
Domele is offline   Reply With Quote
Old 05-17-2011, 10:11 AM   #3 (permalink)
Registered Member
 
TrueScot's Avatar
 
Join Date: Oct 2009
Posts: 48
TrueScot is on a distinguished road
Default

Quote:
Originally Posted by Domele View Post
Post how/where you are creating the textfield and how/where you are hiding it.



The UITextField is created in IB and is set to hidden. It is then connected to

.h

UIPickerView *pickerView;
IBOutlet UILabel *healthType;
IBOutlet UITextField *projectName;
IBOutlet UIImageView *projectNameMask;
IBOutlet UILabel *projectNameLabel;
IBOutlet UITextView *instructions;
IBOutlet NSString *alertString;


}
@property (retain, nonatomic) UIPickerView *pickerView;
@property (nonatomic, retain) UILabel *healthType;
@property (retain, nonatomic) UITextField *projectName;
@property (retain, nonatomic) UIImageView *projectNameMask;
@property (retain, nonatomic) UITextView *instructions;
@property (retain, nonatomic) UILabel *projectNameLabel;
@property (retain, nonatomic) NSString *alertString;


.m

@synthesize pickerView;
@synthesize healthType;
@synthesize projectName;
@synthesize projectNameMask;
@synthesize instructions;
@synthesize projectNameLabel;
@synthesize alertString;


// SHOW HIDDEN TEXTFIELD AND CREATE PROJECT
-(IBAction) createProject: (id) sender {

// Show field for entry of Project Name

[pickerView removeFromSuperview];
projectNameMask.hidden =NO;
projectNameLabel.hidden =NO;
projectName.hidden =NO;
instructions.hidden =YES;

}
TrueScot is offline   Reply With Quote
Old 05-17-2011, 10:32 AM   #4 (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

Smells like a memory management problem. It's not in the code you have shown.
__________________
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-17-2011, 11:06 PM   #5 (permalink)
Registered Member
 
ngaikwad's Avatar
 
Join Date: Feb 2011
Location: Mobile World
Posts: 450
ngaikwad is on a distinguished road
Default

Quote:
Originally Posted by TrueScot View Post
The UITextField is created in IB and is set to hidden. It is then connected to

.h

UIPickerView *pickerView;
IBOutlet UILabel *healthType;
IBOutlet UITextField *projectName;
IBOutlet UIImageView *projectNameMask;
IBOutlet UILabel *projectNameLabel;
IBOutlet UITextView *instructions;
IBOutlet NSString *alertString;


}
@property (retain, nonatomic) UIPickerView *pickerView;
@property (nonatomic, retain) UILabel *healthType;
@property (retain, nonatomic) UITextField *projectName;
@property (retain, nonatomic) UIImageView *projectNameMask;
@property (retain, nonatomic) UITextView *instructions;
@property (retain, nonatomic) UILabel *projectNameLabel;
@property (retain, nonatomic) NSString *alertString;


.m

@synthesize pickerView;
@synthesize healthType;
@synthesize projectName;
@synthesize projectNameMask;
@synthesize instructions;
@synthesize projectNameLabel;
@synthesize alertString;


// SHOW HIDDEN TEXTFIELD AND CREATE PROJECT
-(IBAction) createProject: (id) sender {

// Show field for entry of Project Name

[pickerView removeFromSuperview];
projectNameMask.hidden =NO;
projectNameLabel.hidden =NO;
projectName.hidden =NO;
instructions.hidden =YES;

}
are you join the ibooutlet to interface
__________________
Thank & Regard
NI3(Not Impossible 3)
ngaikwad is offline   Reply With Quote
Old 05-18-2011, 02:52 AM   #6 (permalink)
Registered Member
 
TrueScot's Avatar
 
Join Date: Oct 2009
Posts: 48
TrueScot is on a distinguished road
Default

Sorted. The row from the pickerview component was being used as an index to an NSMutableArray to retrieve a string to be used elsewhere. A ".text" was missing from the UILabel (nothing to do with the UITextField) and this caused it to crash.

Thanks for input everyone.
TrueScot is offline   Reply With Quote
Reply

Bookmarks

Tags
uipickerview, uitextfield

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: 355
7 members and 348 guests
doffing81, dre, iOS.Lover, Kirkout, MikaelBartlett, PlutoPrime, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

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