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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.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-30-2009, 06:35 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2009
Location: Orange County, California
Posts: 36
Send a message via AIM to ShayansMind Send a message via Skype™ to ShayansMind
Default UIPickerView Help Please! :)

Hi, this is my first time working with a pickerview. anyways i have 6 items in my pickerview- (it works). i want to make it were if you click on row 1 it shows a actionsheet-i've done it but now any row i click a action sheet shows up- is there a way i can make only row one trigger a actionsheet

Help is widely appreciated
I will wait for responses and if needed i will post my code

but just setup a example code for me please

Thanks!
ShayansMind is offline   Reply With Quote
Old 11-30-2009, 06:39 PM   #2 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,886
Default

Use an if statement in your UIPickerView delegate method for when a row is selected to see if it's the row you want to show an actionsheet for:
Code:
if (row == 1){
  [show actionsheet];
}
Tom
harrytheshark is offline   Reply With Quote
Old 11-30-2009, 07:32 PM   #3 (permalink)
Registered Member
 
Join Date: Nov 2009
Location: Orange County, California
Posts: 36
Send a message via AIM to ShayansMind Send a message via Skype™ to ShayansMind
Default UIPicker

would "row" have to be declared anywhere? do u have skype or aim

PM me
ShayansMind is offline   Reply With Quote
Old 12-01-2009, 04:33 AM   #4 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 57
Default

where do you use the uipickerview value??
i suppose you have an action like this:

Code:
- (IBAction)buttonPressed {
	NSInteger row = [myPicker selectedRowInComponent:0];
if (row==0){
	NSString *selected = [myPicker objectAtIndex:row];
	NSString *title = [[NSString alloc] initWithFormat:@"you selected: %@",selected];
	UIAlertView *alert = [[UIAlertView alloc]
						  initWithTitle:title
						  message:@"FOO"
						  delegate:nil
						  cancelButtonTitle:@"OK"
						  otherButtonTitles:nil ];
	[alert show];
	
	//release
	[alert release];
	[title release];
	}
}
ignazioc is offline   Reply With Quote
Old 12-01-2009, 07:15 AM   #5 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,886
Default

Row is declared in the delegate method:
Code:
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
That will be called every time your picker view changes, so just check the row in that.

Tom.
harrytheshark is offline   Reply With Quote
Reply

Bookmarks

Tags
actionsheet, pickerview, uipickerview

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: 263
14 members and 249 guests
2WeeksToGo, AdamL, ADY, BrianSlick, Dani77, Dattee, headkaze, mer10, prchn4christ, smithdale87, timle8n1, Touchmint, vigu360
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,879
Threads: 89,228
Posts: 380,747
Top Poster: BrianSlick (7,129)
Welcome to our newest member, mgon987
Powered by vBadvanced CMPS v3.1.0

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