SlideShare a Scribd company logo
iOS Programming
Objective C + iOS
Profile
Ankit Desai
๏‚ก Ph.D. Scholar, IET, Ahmedabad University
๏‚ก Education: M. Tech. CE, B.E. I. T.
๏‚ก Experience: 7.5 Years (Academic and Research)
๏‚ก Research Interest: IoT, Big Data Analytics,
Machine Learning, Data Mining.
UIPickerView Control
๏‚ก Drag a UIPickerView on xib
๏‚ก Add delegates after class-name
<UIPickerViewDataSource,UIPickerViewDelegate>
๏‚ก Declare two NSArray in .h file
๏‚ก NSArray *arrItems;
๏‚ก NSArray *arrLocation;
Initialize arrays in .m files
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
arrItems=[[NSArray
alloc]initWithObjects:@"iphone",@"android",@"java",@"testing", nil];
arrLocation=[[NSArray
alloc]initWithObjects:@"ahmedabad",@"baroda",@"surat", nil];
}
Add delegates methods 1 & 2
// returns the number of 'columns' to display.
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{ return 2; }
// returns the # of rows in each component..
- (NSInteger)pickerView:(UIPickerView *)pickerView
numberOfRowsInComponent:(NSInteger)component
{
if (component==0) {
return [arrItems count];
}
else {
return [arrLocation count];
}
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row
forComponent:(NSInteger)component
{
if (component==0) {
return [arrItems objectAtIndex:row];
}
else {
return [arrLocation objectAtIndex:row];
}
}
Add delegates methods 3
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row
inComponent:(NSInteger)component
{
NSString *Str;
if (component==0) {
Str =[arrItems objectAtIndex:row];
}
else{
Str = [arrLocation objectAtIndex:row];
}
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"selected" message:Str
delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];
[alert show];
}
Add delegates methods 4
Output
Thank you
๏‚ก For further communication or queries:
๏‚ก Contact me:
๏‚ก desaiankitb@gmail.com
๏‚ก www.fb.com/desaiankitb

More Related Content

Viewers also liked (11)

PPTX
Presentation6 ui image_view
Ankit Desai
ย 
PPTX
java code and document security
Ankit Desai
ย 
PPTX
Presentation11 sq lite
Ankit Desai
ย 
PPTX
Java RMI
Ankit Desai
ย 
PPTX
Presentation7 segment control
Ankit Desai
ย 
PPT
Java Networking
Ankit Desai
ย 
PPTX
java drag and drop and data transfer
Ankit Desai
ย 
PPTX
java Jdbc
Ankit Desai
ย 
PPTX
Java Beans
Ankit Desai
ย 
PPT
JDBC
Ankit Desai
ย 
PPT
java swing programming
Ankit Desai
ย 
Presentation6 ui image_view
Ankit Desai
ย 
java code and document security
Ankit Desai
ย 
Presentation11 sq lite
Ankit Desai
ย 
Java RMI
Ankit Desai
ย 
Presentation7 segment control
Ankit Desai
ย 
Java Networking
Ankit Desai
ย 
java drag and drop and data transfer
Ankit Desai
ย 
java Jdbc
Ankit Desai
ย 
Java Beans
Ankit Desai
ย 
JDBC
Ankit Desai
ย 
java swing programming
Ankit Desai
ย 

Similar to Presentation5 picker view (12)

PDF
20180721 code defragment
Chiwon Song
ย 
PPT
Beginning iphone 4_devlopement_chpter7_tab_b
Jihoon Kong
ย 
PPTX
iOS Core location
Richa Jain
ย 
PDF
Advanced, Composable Collection Views, From CocoaCoders meetup Austin Feb 12,...
Carl Brown
ย 
PPT
08 objective-c session 8
Amr Elghadban (AmrAngry)
ย 
PDF
Minimizing Decision Fatigue to Improve Team Productivity
Derek Lee
ย 
PDF
Collection View
Hangyeol Lee
ย 
PPT
iOS Programming 101
rwenderlich
ย 
PDF
201104 iphone navigation-based apps
Javier Gonzalez-Sanchez
ย 
PPTX
Basic iOS Training with SWIFT - Part 3
Manoj Ellappan
ย 
ZIP
Day 2
Pat Zearfoss
ย 
PDF
IOS APPs Revision
Muhammad Amin
ย 
20180721 code defragment
Chiwon Song
ย 
Beginning iphone 4_devlopement_chpter7_tab_b
Jihoon Kong
ย 
iOS Core location
Richa Jain
ย 
Advanced, Composable Collection Views, From CocoaCoders meetup Austin Feb 12,...
Carl Brown
ย 
08 objective-c session 8
Amr Elghadban (AmrAngry)
ย 
Minimizing Decision Fatigue to Improve Team Productivity
Derek Lee
ย 
Collection View
Hangyeol Lee
ย 
iOS Programming 101
rwenderlich
ย 
201104 iphone navigation-based apps
Javier Gonzalez-Sanchez
ย 
Basic iOS Training with SWIFT - Part 3
Manoj Ellappan
ย 
Day 2
Pat Zearfoss
ย 
IOS APPs Revision
Muhammad Amin
ย 
Ad

Recently uploaded (20)

PDF
Notification System for Construction Logistics Application
Safe Software
ย 
PPTX
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
ย 
PPT
Brief History of Python by Learning Python in three hours
adanechb21
ย 
PDF
Step-by-Step Guide to Install SAP HANA Studio | Complete Installation Tutoria...
SAP Vista, an A L T Z E N Company
ย 
PDF
Optimizing Tiered Storage for Low-Latency Real-Time Analytics at AI Scale
Alluxio, Inc.
ย 
PPTX
MiniTool Partition Wizard Crack 12.8 + Serial Key Download Latest [2025]
filmoracrack9001
ย 
PDF
custom development enhancement | Togglenow.pdf
aswinisuhu
ย 
PPTX
Operations Profile SPDX_Update_20250711_Example_05_03.pptx
Shane Coughlan
ย 
PDF
ESUG 2025: Pharo 13 and Beyond (Stephane Ducasse)
ESUG
ย 
PDF
How AI in Healthcare Apps Can Help You Enhance Patient Care?
Lilly Gracia
ย 
PDF
SAP GUI Installation Guide for macOS (iOS) | Connect to SAP Systems on Mac
SAP Vista, an A L T Z E N Company
ย 
PDF
Why Are More Businesses Choosing Partners Over Freelancers for Salesforce.pdf
Cymetrix Software
ย 
PDF
Top 10 AI Use Cases Every Business Should Know.pdf
nicogonzalez1075
ย 
PDF
Dialora AI Voice Agent for Customer Support
Dialora. Ai
ย 
PDF
Meet in the Middle: Solving the Low-Latency Challenge for Agentic AI
Alluxio, Inc.
ย 
PPTX
ChessBase 18.02 Crack + Serial Key Free Download
cracked shares
ย 
PPTX
TexSender Pro 8.9.1 Crack Full Version Download
cracked shares
ย 
PPTX
Chess King 25.0.0.2500 With Crack Full Free Download
cracked shares
ย 
PDF
Ready Layer One: Intro to the Model Context Protocol
mmckenna1
ย 
PPTX
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
ย 
Notification System for Construction Logistics Application
Safe Software
ย 
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
ย 
Brief History of Python by Learning Python in three hours
adanechb21
ย 
Step-by-Step Guide to Install SAP HANA Studio | Complete Installation Tutoria...
SAP Vista, an A L T Z E N Company
ย 
Optimizing Tiered Storage for Low-Latency Real-Time Analytics at AI Scale
Alluxio, Inc.
ย 
MiniTool Partition Wizard Crack 12.8 + Serial Key Download Latest [2025]
filmoracrack9001
ย 
custom development enhancement | Togglenow.pdf
aswinisuhu
ย 
Operations Profile SPDX_Update_20250711_Example_05_03.pptx
Shane Coughlan
ย 
ESUG 2025: Pharo 13 and Beyond (Stephane Ducasse)
ESUG
ย 
How AI in Healthcare Apps Can Help You Enhance Patient Care?
Lilly Gracia
ย 
SAP GUI Installation Guide for macOS (iOS) | Connect to SAP Systems on Mac
SAP Vista, an A L T Z E N Company
ย 
Why Are More Businesses Choosing Partners Over Freelancers for Salesforce.pdf
Cymetrix Software
ย 
Top 10 AI Use Cases Every Business Should Know.pdf
nicogonzalez1075
ย 
Dialora AI Voice Agent for Customer Support
Dialora. Ai
ย 
Meet in the Middle: Solving the Low-Latency Challenge for Agentic AI
Alluxio, Inc.
ย 
ChessBase 18.02 Crack + Serial Key Free Download
cracked shares
ย 
TexSender Pro 8.9.1 Crack Full Version Download
cracked shares
ย 
Chess King 25.0.0.2500 With Crack Full Free Download
cracked shares
ย 
Ready Layer One: Intro to the Model Context Protocol
mmckenna1
ย 
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
ย 
Ad

Presentation5 picker view

  • 2. Profile Ankit Desai ๏‚ก Ph.D. Scholar, IET, Ahmedabad University ๏‚ก Education: M. Tech. CE, B.E. I. T. ๏‚ก Experience: 7.5 Years (Academic and Research) ๏‚ก Research Interest: IoT, Big Data Analytics, Machine Learning, Data Mining.
  • 3. UIPickerView Control ๏‚ก Drag a UIPickerView on xib ๏‚ก Add delegates after class-name <UIPickerViewDataSource,UIPickerViewDelegate> ๏‚ก Declare two NSArray in .h file ๏‚ก NSArray *arrItems; ๏‚ก NSArray *arrLocation;
  • 4. Initialize arrays in .m files - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. arrItems=[[NSArray alloc]initWithObjects:@"iphone",@"android",@"java",@"testing", nil]; arrLocation=[[NSArray alloc]initWithObjects:@"ahmedabad",@"baroda",@"surat", nil]; }
  • 5. Add delegates methods 1 & 2 // returns the number of 'columns' to display. - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return 2; } // returns the # of rows in each component.. - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { if (component==0) { return [arrItems count]; } else { return [arrLocation count]; } }
  • 6. - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { if (component==0) { return [arrItems objectAtIndex:row]; } else { return [arrLocation objectAtIndex:row]; } } Add delegates methods 3
  • 7. - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { NSString *Str; if (component==0) { Str =[arrItems objectAtIndex:row]; } else{ Str = [arrLocation objectAtIndex:row]; } UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"selected" message:Str delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil]; [alert show]; } Add delegates methods 4
  • 9. Thank you ๏‚ก For further communication or queries: ๏‚ก Contact me: ๏‚ก [email protected] ๏‚ก www.fb.com/desaiankitb