Showing a UIPickerView with UIActionSheet in iOS8 not showing
-(void)showPicker{
/************************ FIXED please contact me on nfsarmento#hotmail.com if you need help to fix******//
actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
[actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
CGRect pickerFrame = CGRectMake(0, 40, 0, 0);
UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:pickerFrame];
pickerView.showsSelectionIndicator = YES;
switch((uint)currentDelegate){
case 0:{
pickerView.dataSource = propertyDelegate;
pickerView.delegate = propertyDelegate;
[pickerView selectRow:[propertyDelegate index] inComponent:0 animated:NO];
break;
}
case 1:{
pickerView.dataSource = regionDelegate;
pickerView.delegate = regionDelegate;
[pickerView selectRow:[regionDelegate index] inComponent:0 animated:NO];
break;
}
case 2:{
pickerView.dataSource = townDelegate;
pickerView.delegate = townDelegate;
[pickerView selectRow:[townDelegate index] inComponent:0 animated:NO];
break;
}
case 3:{
pickerView.dataSource = bedDelegate;
pickerView.delegate = bedDelegate;
[pickerView selectRow:[bedDelegate index] inComponent:0 animated:NO];
break;
}
case 4:{
pickerView.dataSource = bathDelegate;
pickerView.delegate = bathDelegate;
[pickerView selectRow:[bathDelegate index] inComponent:0 animated:NO];
break;
}
case 5:{
pickerView.dataSource = priceDelegate;
pickerView.delegate = priceDelegate;
[pickerView selectRow:[priceDelegate index1] inComponent:0 animated:NO];
[pickerView selectRow:[priceDelegate index2] inComponent:1 animated:NO];
break;
}
case 6:{
pickerView.dataSource = currencyDelegate;
pickerView.delegate = currencyDelegate;
[pickerView selectRow:[currencyDelegate index] inComponent:0 animated:NO];
break;
}
}
[actionSheet addSubview:pickerView];
UISegmentedControl *previousButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:NSLocalizedString(#"Previous", nil)]];
previousButton.momentary = YES;
previousButton.frame = CGRectMake(5.0f, 7.0f, 70.0f, 30.0f);
previousButton.segmentedControlStyle = UISegmentedControlStyleBar;
previousButton.tintColor = [UIColor blackColor];
UISegmentedControl *nextButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:NSLocalizedString(#"Next", nil)]];
nextButton.momentary = YES;
nextButton.frame = CGRectMake(80.0f, 7.0f, 70.0f, 30.0f);
nextButton.segmentedControlStyle = UISegmentedControlStyleBar;
nextButton.tintColor = [UIColor blackColor];
UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:NSLocalizedString(#"Done", nil)]];
closeButton.momentary = YES;
closeButton.frame = CGRectMake(240, 7.0f, 70.0f, 30.0f);
closeButton.segmentedControlStyle = UISegmentedControlStyleBar;
closeButton.tintColor = [UIColor colorWithRed:0.35f green:0.55f blue:1.5f alpha:1.0f];
[closeButton addTarget:self action:#selector(hidePicker) forControlEvents:UIControlEventValueChanged];
[previousButton addTarget:self action:#selector(previousPicker) forControlEvents:UIControlEventValueChanged];
[nextButton addTarget:self action:#selector(nextPicker) forControlEvents:UIControlEventValueChanged];
if(currentDelegate > 0)[actionSheet addSubview:previousButton];
if(currentDelegate < 6)[actionSheet addSubview:nextButton];
[actionSheet addSubview:closeButton];
[actionSheet showInView:[[UIApplication sharedApplication] keyWindow]];
[actionSheet setBounds:CGRectMake(0, 0, 320, 485)];
}
-(void) nextPicker{
[self hidePicker];
currentDelegate++;
[self showPicker];
}
-(void) previousPicker{
[self hidePicker];
currentDelegate--;
[self showPicker];
}
-(void)hidePicker{
switch ((uint)currentDelegate) {
case 0:{
[tf_type setText: [propertyDelegate.values objectAtIndex: [propertyDelegate index]]];
_appDelegate.int_typeV = [propertyDelegate index];
break;
}
case 1:{
[tf_region setText: [regionDelegate.values objectAtIndex: [regionDelegate index]]];
_appDelegate.int_regionV = [regionDelegate index];
//Reset Town dropdown when a region is picked
_appDelegate.int_townV = 0;
townDelegate = [[TownDelegate alloc] init];
[self.tf_town setText: [townDelegate.values objectAtIndex: [_appDelegate int_townV]]];
break;
}
case 2:{
[tf_town setText: [townDelegate.values objectAtIndex: [townDelegate index]]];
_appDelegate.int_townV = [townDelegate index];
break;
}
case 3:{
[tf_numBed setText: [bedDelegate.values objectAtIndex: [bedDelegate index]]];
_appDelegate.int_numBedV = [bedDelegate index];
break;
}
case 4:{
[tf_numBath setText: [bathDelegate.values objectAtIndex: [bathDelegate index]]];
_appDelegate.int_numBathV = [bathDelegate index];
break;
}
case 5:{
NSString * priceString = [[NSString alloc] initWithFormat:#"%# - %#",
[priceDelegate.values objectAtIndex: [priceDelegate index1]],
[priceDelegate.values2 objectAtIndex: [priceDelegate index2]]];
[tf_price setText:priceString];
_appDelegate.int_minPriceV = [priceDelegate index1];
_appDelegate.int_maxPriceV = [priceDelegate index2];
break;
}
case 6:{
[tf_currency setText: [currencyDelegate.values objectAtIndex: [currencyDelegate index]]];
_appDelegate.int_currencyV = [currencyDelegate index];
break;
}
}
[popoverController dismissPopoverAnimated:YES];
popoverController = nil;
[self dismissActionSheet];
}
My picker view
#import "PropertyTypeDelegate.h"
#implementation PropertyTypeDelegate
#synthesize values;
-(id)init{
self = [super init];
[self loadData];
return self;
}
-(int)index{ return index;}
-(void) loadData{
NSArray* array = [[NSArray alloc] initWithObjects:
NSLocalizedString(#"No Preference", nil),
NSLocalizedString(#"Villa", nil),
NSLocalizedString(#"Town House", nil),
NSLocalizedString(#"Apartment", nil),
NSLocalizedString(#"Retail", nil),
NSLocalizedString(#"Labour Camp", nil),
NSLocalizedString(#"Office", nil),
NSLocalizedString(#"Warehouse", nil),
NSLocalizedString(#"Land Residential", nil),
NSLocalizedString(#"Hotel apartment", nil),
NSLocalizedString(#"Residential Building", nil),
nil];
self.values = array;
index = 0;
}
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{
return 1;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
return [values count];
}
-(NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent: (NSInteger)component{ return [values objectAtIndex:row];
}
-(void)pickerView:(UIPickerView *) thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
index = (int) (NSInteger)row;
}
#end
The link provided above actually refers to Apple Doc where it has removed adding subview to UIActionSheet. In your code, you are doing similar thing by adding UIPickerView into UIActionSheet. So in iOS8 onwards, even if the view is added to UIActionSheet, the view returned is actually nil while displaying.
For this purpose you can use ActionSheetPicker-3.0.
Actually, it's not UIActionSheet anymore. But looks exactly the same, and that's why it works on iOS8.
Do let me know if this answers your query!
Related
(
{
"first_name" = Akash;
idprofile = 1;
iduser = 1;
"last_name" = Testing;
picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/1_Jellyfish.jpg";
"profile_picture_filepath" = "1_Jellyfish.jpg";
},
{
"first_name" = testing;
idprofile = 3;
iduser = 1;
"last_name" = tst;
picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/3_Penguins.jpg";
"profile_picture_filepath" = "3_Penguins.jpg";
},
{
"first_name" = test;
idprofile = 4;
iduser = 1;
"last_name" = test;
picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/4_Chrysanthemum.jpg";
"profile_picture_filepath" = "4_Chrysanthemum.jpg";
},
{
"first_name" = prashant1;
idprofile = 19;
iduser = 1;
"last_name" = kharade1;
picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/19_Koala.jpg";
"profile_picture_filepath" = "19_Koala.jpg";
},
{
"first_name" = Priyank;
idprofile = 68;
iduser = 1;
"last_name" = Jain;
picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/68_P.jpg";
"profile_picture_filepath" = "68_P.jpg";
},
{
"first_name" = sdasd;
idprofile = 106;
iduser = 1;
"last_name" = sdasd;
picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/";
"profile_picture_filepath" = "<null>";
}
)
this is my json response data. I want to display the six profiles(6 dictionaries) based on the "idprofile" key in a table view with first_name, last_name and the profile image. I am getting confused. Please help?
here's my code:
- (void)viewDidLoad
{
[super viewDidLoad];
AppDelegate *appDel = [[UIApplication sharedApplication]delegate];
navBar=[[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
[navBar setTintColor:[UIColor colorWithRed:0.0f/255.0f green:82.0f/255.0f blue:151.0f/255.0f alpha:1.0f]];
UIImageView *myImageView=[[UIImageView alloc] initWithFrame:CGRectMake(87, 3, 134, 33)];
myImageView.image=[UIImage imageNamed:#"sprofile.png"];
[navBar addSubview:myImageView];
//[myImageView release];
[self.view addSubview:navBar];
UIButton *logOutButton=[UIButton buttonWithType:UIButtonTypeCustom] ;
[logOutButton setFrame:CGRectMake(244, 10, 71, 32)];
//[logOutButton setTitle:#"Log out" forState:UIControlStateNormal];
[logOutButton setImage:[UIImage imageNamed:#"logout.png"] forState:UIControlStateNormal];
[logOutButton addTarget:self action:#selector(goToLoginScreen) forControlEvents:UIControlEventTouchUpInside];
[navBar addSubview:logOutButton];
UILabel *headerLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 50, 320, 30)];
[headerLabel setBackgroundColor:[UIColor colorWithRed:210.0f/255.0f green:221.0f/255.0f blue:228.0f/255.0f alpha:1.0f]];
[headerLabel setText:#"Currently selected profile: Please select"];
[headerLabel setTextAlignment:NSTextAlignmentCenter];
[headerLabel setFont:[UIFont fontWithName:#"helvetica" size:14.0f]];
[headerLabel setTextColor:[UIColor colorWithRed:78.0f/255.0f green:126.0f/255.0f blue:70.0f/255.0f alpha:1.0f]];
[self.view addSubview:headerLabel];
homeTable=[[UITableView alloc] initWithFrame:CGRectMake(0, 81, 320, 367) style:UITableViewStylePlain];
[homeTable setBackgroundColor:[UIColor colorWithRed:232.0f/255.0f green:237.0f/255.0f blue:240.0f/255.0f alpha:1.0f]];
homeTable.delegate=self;
homeTable.dataSource=self;
homeTable.rowHeight=100;
[self.view addSubview:homeTable];
profileArray = [[NSMutableArray alloc]init];
[self callWebService];
}
-(void)goToLoginScreen
{
AppDelegate *appDelegate=(AppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate.window.rootViewController dismissViewControllerAnimated:YES completion:nil];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [profileArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
UIButton *selectButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
selectButton.frame = CGRectMake(100, 30, 63, 32);
//[selectButton setBackgroundColor:[UIColor yellowColor]];
[selectButton setBackgroundImage:[UIImage imageNamed:#"select.png"] forState:UIControlStateNormal];
//[selectButton addTarget:self action:#selector(selectButtonSelected: ) forControlEvents:UIControlEventTouchUpInside];
selectButton.tag = indexPath.row;
[cell.contentView addSubview:selectButton];
// NSDictionary *item = [profileArray objectAtIndex:[indexPath row]];
// [[cell textLabel] setText:[item objectForKey:#"first_name"]];
// Home *tempHomeObj=(Home *)[profileArray objectAtIndex:indexPath.row];
// NSString *fName = (NSString *)tempHomeObj.fName;
// NSLog(#"fnameeeee==>%#",fName);
//NSLog(#"fName==>%#",appDel.fName);
AppDelegate *appDel=(AppDelegate *)[[UIApplication sharedApplication] delegate];
NSLog(#"profileeeee==>%#",profileArray);
// NSMutableString *tempStr = (NSMutableString *)profileArray;
cell.textLabel.text = [self.profileArray objectAtIndex:indexPath.row];
//cell.imageView.image = appDel.tempUserImage;
return cell;
}
-(void)callWebService
{
//adding the indicator view to show that data is being processed.......
indicatorView=[[UIView alloc] initWithFrame:CGRectMake(110 ,180,100 , 100)];
indicatorView.tag=3000;
[indicatorView setAlpha:0.7];
indicatorView.layer.cornerRadius=15;
indicatorView.backgroundColor=[UIColor blackColor];
[self.view addSubview:indicatorView];
//now adding the activity indicator
activityIndicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
//activityIndicator.frame = CGRectMake(20.0,20.0, 40.0, 40.0);
//activityIndicator.center = indicatorView.center;
activityIndicator.center=CGPointMake(50, 50);
[activityIndicator startAnimating];
[[self.view viewWithTag:3000]addSubview:activityIndicator];
// AppDelegate *appDelegate = [[UIApplication sharedApplication]delegate];
NSURL *url = [NSURL URLWithString:#"http://qalina.acapglobal.com/kangatime/kangatime_api/api/user/all_profiles/format/json"];
ASIFormDataRequest *request=[ASIFormDataRequest requestWithURL:url];
[request addPostValue:#"1" forKey:#"id"];
//[request addPostValue:pwdField.text forKey:#"pass"];
[request setDelegate:self];
[request startAsynchronous];
}
- (void)requestFinished:(ASIHTTPRequest *)request
{
// Use when fetching text data
NSString *responseString = [request responseString];
// NSLog(#"responsestring==%#",responseString);
NSMutableArray *responseArr= [responseString JSONValue];
NSLog(#"responseArr==>%#",responseArr);
NSDictionary *tempDict = [responseArr objectAtIndex:0];
//NSLog(#"tempDict==>%#",tempDict);
if(indicatorView!=nil)
{
[indicatorView removeFromSuperview];
indicatorView=nil;
}
for(NSDictionary *dict in tempDict)
{
Home *objHome=[[Home alloc] init];
AppDelegate *appDel = [[UIApplication sharedApplication]delegate];
appDel.fName = [tempDict objectForKey:#"first_name"];
NSLog(#"appDel.fName==>%#",appDel.fName );
appDel.lName = [tempDict objectForKey:#"last_name"];
//NSLog(#"lName==>%#",lName);
NSMutableString *myStr=[NSMutableString stringWithString:appDel.fName];
[myStr appendFormat:#" "];
[myStr appendString:appDel.lName];
objHome.userName=myStr;
NSLog(#"objHome.userName==>%#",objHome.userName);
NSString *idProfile = [tempDict objectForKey:#"idprofile"];
NSLog(#"idProfile==>%#",idProfile);
// NSString *imageStr=[tempDict objectForKey:#"profile_picture_filepath"];
// NSMutableString *urlString= [NSMutableString stringWithString:#"http://qalina.acapglobal.com/kangatime/ktapp/profilepics/"];
// [urlString appendString:imageStr];
// NSURL *mainURL=[[[NSURL alloc] initWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]] autorelease];
// // NSLog(#"mainURL==>%#",mainURL);
//
// appDel.tempUserData = [[NSData alloc] initWithContentsOfURL:mainURL];
//NSLog(#"tempUserData==>%#",tempUserData);
// Home *objHome=[[Home alloc] init];
//appDel.tempUserImage = [[UIImage alloc] initWithData:appDel.tempUserData];
[profileArray addObject:objHome.userName];
// [profileArray addObject:appDel.tempUserImage];
NSLog(#"profileArray==>%d",[profileArray count]);
}
//[profileArray addObject:]
// [homeTable setDataSource:self];
// [homeTable setDelegate:self];
[homeTable reloadData];
//[self setProfileArray:[tempDict objectForKey:#"first_name"]];
}
first you have parse the json. to parse the jason you can use JSONKit
With the help of JSONKIT, first you have to parse response string.
You will get array or dictionary from JSON response. #SmartWork has provided you a link for JSONKIT and How to create JSON Array string given below? will help you out to retrieve array/dictionary from response.
Ive picked up some code form another developer which im trying to put right. One of the problems is:
I have 2 pickers that fill a text box with selected row from a picker.
If picker 1 (named: Type) is selected, the row selected ..say row 3, defaults to that row on my next picker (named: FlueType) when the picker is presented.
How can I get the second picker not be affected by the first pickers row selection?
Ive looked at [picker reloadComponent:0]; I've looked on stack and google and cant seem to find anything that fits this problem.
Ive also tried [picker selectRow:0 inComponent:0 animated:NO] in the ViewDidLoad method hoping that it would set all my pickers to the first row value which is all im trying to do.
Apologies for the mountain of code, I've tried to separate it out into context
/////////////////////picker action////////////////////////
-(void)flueTypeBtnClicked//:(id)sender
{
[flueTypeBtn.titleLabel setTextColor:[UIColor blackColor]];
currentSelectedIndex = flueTypeBtn.tag;
[makeTxt resignFirstResponder];
[modelTxt resignFirstResponder];
[locationTxt resignFirstResponder];
[oprPressureMBarTxt resignFirstResponder];
[picker setHidden:NO];
[picker reloadComponent:0];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
self.ToolsView.frame = CGRectMake(0, 200, 320, 260);
extern GasCertificateAppViewController *viewController;
[viewController.view addSubview:self.ToolsView];
[UIView commitAnimations];
}
-(void)typeBtnClicked//:(id)sender
{
[typeBtn.titleLabel setTextColor:[UIColor blackColor]];
currentSelectedIndex = typeBtn.tag;
[makeTxt resignFirstResponder];
[modelTxt resignFirstResponder];
[locationTxt resignFirstResponder];
[oprPressureMBarTxt resignFirstResponder];
[picker setHidden:NO];
[picker reloadComponent:0];
//NSLog(#"In type btn Clicked:");
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
self.ToolsView.frame = CGRectMake(0, 200, 320, 260);
extern GasCertificateAppViewController *viewController;
[viewController.view addSubview:self.ToolsView];
[UIView commitAnimations];
///////////////////////////////////////////////////////////////////////////////////////////////////////////////more code here///////////////////////
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
if (textField.tag == 1 )
{
[self typeBtnClicked];
return NO;
}
else if(textField.tag == 3)
{
[self flueTypeBtnClicked];
return NO;
}
CGPoint offset = CGPointMake(0, textField.frame.origin.y - textField.frame.size.height);
[self.screenScrollView setContentOffset: offset animated: YES];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
self.ToolsView.frame = CGRectMake(0, 200, 320, 260);
extern GasCertificateAppViewController *viewController;
[viewController.view addSubview:self.ToolsView];
[UIView commitAnimations];
return YES;
}
//////////////
-(void) fillData
{
extern Survey *survey;
ApplianceTest *test = [survey.applianceTestArray objectAtIndex:testId];
if(test.type != nil)
[self.typeTxt setText:test.type];
// [self.typeBtn setTitle:test.type forState:UIControlStateNormal];
if(test.make != nil)
[self.makeTxt setText:test.make];
if(test.model != nil)
[self.modelTxt setText:test.model];
if(test.location != nil)
[self.locationTxt setText:test.location];
if(test.flue_type != nil)
[self.flueTypeTxt setText:test.flue_type];
//[self.flueTypeBtn setTitle:test.flue_type forState:UIControlStateNormal]; if(test.operating_pressure_mbar_or_heat_input_kwh != nil)
[self.oprPressureMBarTxt setText:test.operating_pressure_mbar_or_heat_input_kwh];
if([test.safety_device_correct isEqualToString:#"Yes"])
[self.segtCtrl setSelectedSegmentIndex:0];
else
if([test.safety_device_correct isEqualToString:#"No"])
[self.segtCtrl setSelectedSegmentIndex:1];
else
[self.segtCtrl setSelectedSegmentIndex:2];
}
-(IBAction)bgTouched:(id)sender
{
CGPoint offset = CGPointMake(0, 0);
[self.screenScrollView setContentOffset: offset animated: YES];[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
self.ToolsView.frame = CGRectMake(0, 500, 320,260);
//[self.ToolsView removeFromSuperview];
//self.view.frame = CGRectMake(0, 0, 320, 372 );
[makeTxt resignFirstResponder];
[modelTxt resignFirstResponder];
[locationTxt resignFirstResponder];
[oprPressureMBarTxt resignFirstResponder];
[UIView commitAnimations];
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)viewDidLoad {
[super viewDidLoad];
//segment control selected Index = 2;
segtCtrl.selectedSegmentIndex = 2;
navigationTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(130, 0, 200, 25)];
navigationTitleLabel.textAlignment = UITextAlignmentCenter;
navigationTitleLabel.font= [UIFont fontWithName:#"Futura" size:18];
navigationTitleLabel.backgroundColor = [UIColor clearColor];
navigationTitleLabel.textColor = [UIColor whiteColor];
navigationTitleLabel.text = #"Appliance Test 1/3";
self.navigationItem.titleView = navigationTitleLabel;
self.screenScrollView.frame = CGRectMake(0, 0, 320, 370);
self.screenScrollView.contentSize = CGSizeMake(320, 600 + 200);
self.screenScrollView.clipsToBounds = YES;
self.screenScrollView.showsVerticalScrollIndicator = NO;
[self.view addSubview:self.screenScrollView];
testId = [testIdStr intValue];
currentSelectedIndex = 0;
typeArray = [[NSMutableArray alloc] init];
[typeArray addObject:#""]; ///change
[typeArray addObject:#"Boiler"];
[typeArray addObject:#"Cooker"];
[typeArray addObject:#"Fire"];
[typeArray addObject:#"Hob"]; ///change to hob
currentSelectedIndex = 0;
flueTypeArray = [[NSMutableArray alloc] init];
[flueTypeArray addObject:#""]; //change
[flueTypeArray addObject:#"OF"];
[flueTypeArray addObject:#"RS"];
[flueTypeArray addObject:#"FL"];
unitArray = [[NSMutableArray alloc] initWithObjects:#"MBar",#"KW/h",nil];
//self.navigationItem.title = #"Appliance Test 1/3";
//[typeTableView setHidden:YES];
//[flueTypeTableView setHidden:YES];
[segtCtrl setSelectedSegmentIndex:2];
extern Survey *survey;
[self fillData];
[picker setHidden:YES];
self.ToolsView.frame = CGRectMake(0, 500, 320, 260);
/////////////////
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent: (NSInteger)component
{
if (currentSelectedIndex == 1)
{
return [typeArray count];
}
else if(currentSelectedIndex == 3)
{
return [flueTypeArray count];
}
else if(currentSelectedIndex == 7)
{
return [unitArray count];
}
else
{
return 1;
}
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
if (currentSelectedIndex == 1)
{
if ([typeArray count] == 0)
{
return [NSString stringWithFormat: #"None"];
}
else
{
return [typeArray objectAtIndex:row];
}
}
else if(currentSelectedIndex == 3)
{
if ([flueTypeArray count] == 0)
{
return [NSString stringWithFormat: #"None"];
}
else {
return [flueTypeArray objectAtIndex:row];
}
}
else if(currentSelectedIndex == 7)
{
if ([unitArray count] == 0)
{
return [NSString stringWithFormat: #"None"];
}
else
{
return [unitArray objectAtIndex:row];
}
}
return #"";
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
// [gasSafeNoBtn setTitle:[NSString stringWithFormat:#"%d",[(NSNumber *) [gasSafeNoArray objectAtIndex:row]intValue]] forState:UIControlStateNormal];
extern Survey *survey;
if (currentSelectedIndex==1)
{
//typeTxt.text = [typeArray objectAtIndex:row];
[typeBtn.titleLabel setTextColor:[UIColor blackColor]];
[typeBtn setTitle:[typeArray objectAtIndex:row] forState:UIControlStateNormal];
typeTxt.text =[typeArray objectAtIndex:row] ;
}
else if(currentSelectedIndex == 3)
{
//flueTypeTxt.text = [flueTypeArray objectAtIndex:row];
[flueTypeBtn.titleLabel setTextColor:[UIColor blackColor]];
[flueTypeBtn setTitle:[flueTypeArray objectAtIndex:row] forState:UIControlStateNormal];
flueTypeTxt.text= [flueTypeArray objectAtIndex:row];
}
else if(currentSelectedIndex == 7)
{
unitString = [[NSString alloc] initWithString:[unitArray objectAtIndex:row]];
// NSLog(#"Unit String : %#", unitString);
[unitBtn setTitle:[unitArray objectAtIndex:row] forState:UIControlStateNormal];
}
else {
}
}
- (void)dealloc {
[unitArray release];
[ToolsView release];
[toolBar release];
[nextBtn release];
[prevBtn release];
[doneBtn release];
[picker release];
[super dealloc];
}
#end
Ok sorted....added
[picker selectRow:0 inComponent:0 animated:NO];
to the button action method presenting the picker
I have faced one issue to display UIPickerView with a Done button in Ipad.
I done detailed researches though many links and blogs and got the suggestion as "display the UIPickerView from an UIActionSheet"
I saw many posts related this, however there is no good answers.So please dont close it as a duplicate.
Also i was able to get some good codes to do it and it worked fine in my Iphone devices.
However i were found a difficulty in Ipad devices.
The Action-Sheet is not displaying as a full view.
Please see the below screenshot.this was the result!!!
The code is used to do this is pasted below.
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:nil
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
[actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
CGRect pickerFrame = CGRectMake(0, 40, 0, 0);
UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:pickerFrame];
pickerView.showsSelectionIndicator = YES;
pickerView.dataSource = self;
pickerView.delegate = self;
[actionSheet addSubview:pickerView];
[pickerView release];
UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:#"Close"]];
closeButton.momentary = YES;
closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);
closeButton.segmentedControlStyle = UISegmentedControlStyleBar;
closeButton.tintColor = [UIColor blackColor];
[closeButton addTarget:self action:#selector(dismissActionSheet:) forControlEvents:UIControlEventValueChanged];
[actionSheet addSubview:closeButton];
[closeButton release];
[actionSheet showInView:[[UIApplication sharedApplication] keyWindow]];
[actionSheet setBounds:CGRectMake(0, 0, 320, 485)];
Then I have downloaded a excellent sample application from github through sample pickers
After the download, i have copied the classes only mandatory for me to my application.
The method they are using to show the UIPickerView+Done button through Action-Sheet is described below
ActionStringDoneBlock done = ^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
if ([myLabel respondsToSelector:#selector(setText:)]) {
[myLabel performSelector:#selector(setText:) withObject:selectedValue];
}
};
ActionStringCancelBlock cancel = ^(ActionSheetStringPicker *picker) {
NSLog(#"Block Picker Canceled");
};
NSArray *colors = [NSArray arrayWithObjects:#"Red", #"Green", #"Blue", #"Orange", nil];//picker items to select
[ActionSheetStringPicker showPickerWithTitle:#"Select a Block" rows:colors initialSelection:0 doneBlock:done cancelBlock:cancel origin:myButton];
In the last line of code they have used the parameter as origin: and we can pass any objects (button,label etc) to it.
The Action-sheet will take origin as the passed object.
Here my issue came again :). I have used segment control to pick the time as per my conditions.
if i give mySegment as the origin parameter,the Action-sheet origin arrow will display from middle of my segment control.Not from the selected tab ,which is too bad and will give confusion to my valuable users.
So i have added individual labels under the segment sections and given it for the origin parameter of the mentioned method and i fixed my issue.
However i know its not a good fix :)
May i know is there any easy way to do it?
Is Apple support ActionSheet+UIPickerView+DoneButton in Ipad?
Any help on this issue is Appreciated
-(void)viewDidload
{
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button1.frame = CGRectMake(165,165, 135,35);
[button1 setTitle:#"Type #" forState:UIControlStateNormal];
[button1 addTarget:self action:#selector(button1) forControlEvents:UIControlEventTouchUpInside];
[s addSubview:button1];
}
-(void)button1
{
items1 =[[NSMutableArray alloc]initWithObjects:#"H",#"E",#"T",#"K",nil];
myPickerView1 =[[UIPickerView alloc] initWithFrame:CGRectMake(60,80,200,300)];
myPickerView1.transform = CGAffineTransformMakeScale(0.75f, 0.75f);
myPickerView1.delegate = self;
myPickerView1.dataSource = self;
myPickerView1.showsSelectionIndicator = YES;
myPickerView1.backgroundColor = [UIColor clearColor];
myPickerView1.tag=1;
[myPickerView1 selectRow:1 inComponent:0 animated:YES];
[self.view addSubview:myPickerView1];
}
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView;
{
return 1;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component;
{
switch (pickerView.tag)
{
case 1:
return [items1 count];
break;
case 2:
return [items2 count];
break;
}
return 0;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
switch (pickerView.tag)
{
case 1:
return[items1 objectAtIndex:row];
break;
case 2:
return[items2 objectAtIndex:row];
break;
}
return 0;
}
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
switch (pickerView.tag)
{
case 1:
{
[button1 setTitle:[items1 objectAtIndex:row] forState:UIControlStateNormal];
}
break;
case 2:
{
[button2 setTitle:[items2 objectAtIndex:row] forState:UIControlStateNormal];
}break;
}
pickerView.hidden = YES;
}
You have to use UIPopOverController.
First, create a UIPickerViewController for iPhone. You need it for the nib, which will be pushed into the popOver. Initialize the picker in ViewWithPicker
.h
#import <UIKit/UIKit.h>
#class ViewWithPickerController;
#protocol PopoverPickerDelegate
#required
- (void) viewWithPickerController:(ViewWithPickerController*) viewWithPickerController didSelectValue:(NSString*) value;
#end
#interface ViewWithPickerController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource> {
IBOutlet UIPickerView *pickerView;
id<PopoverPickerDelegate> delegate;
NSMutableArray *array;
}
#property(nonatomic, retain) IBOutlet UIPickerView *pickerView;
#property(nonatomic, assign) id<PopoverPickerDelegate> delegate;
#end
.m, after you initialized the array in viewDidLoad, picker methods:
// returns the number of 'columns' to display.
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)picker {
return 1;
}
// returns the number of rows in each component.
- (NSInteger)pickerView:(UIPickerView *)picker numberOfRowsInComponent:(NSInteger)component {
return [array count];
}
//returns the string value for the current row
- (NSString *)pickerView:(UIPickerView *)picker titleForRow:(NSInteger)row forComponent:(NSInteger)component {
return [array objectAtIndex:row];
}
//handle selection of a row
- (void)pickerView:(UIPickerView *)picker didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
NSString *value = [pickerView.delegate pickerView:picker titleForRow:row forComponent:component];
//notify the delegate about selecting a value
if(delegate != nil)
[delegate viewWithPickerController:self didSelectValue:value];
}
Then, import the viewWithPicker into your main class, create a button and give it this action:
- (IBAction) showPickerPopupAction:(id) sender {
self.viewWithPickerController = [[[ViewWithPickerController alloc] initWithNibName:#"ViewWithPicker" bundle:[NSBundle mainBundle]] autorelease];
viewWithPickerController.contentSizeForViewInPopover =
CGSizeMake(viewWithPickerController.view.frame.size.width, viewWithPickerController.view.frame.size.height);
viewWithPickerController.delegate = self;
self.popoverController = [[[UIPopoverController alloc]
initWithContentViewController:viewWithPickerController] autorelease];
[self.popoverController presentPopoverFromRect:popoverButtonForPicker.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
popoverController.delegate = self;
}
And to select a specific value
- (void) viewWithPickerController:(ViewWithPickerController*) viewWithPickerController didSelectValue:(NSString*) value
{
yourLabel.text = [NSString stringWithFormat:#"%# ",value];
}
Use UIPopoverController for done button in picker, create a view controller class in which take a picker and add navigation cancel and done button.
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:nextViewController];
_datePickerPopover = [[UIPopoverController alloc] initWithContentViewController:navigationController];
nextViewController.datePickerPopover = _datePickerPopover;
_datePickerPopover.delegate=self;
[_datePickerPopover setPopoverContentSize:CGSizeMake(320, 453) animated:NO];
if (isSearchOpen) {
[_datePickerPopover presentPopoverFromRect:CGRectMake(btn.frame.origin.x+10+245, btn.frame.origin.y+100-scrollPointY, 44, 44) inView:self.splitViewController.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
}
else
{
[_datePickerPopover presentPopoverFromRect:CGRectMake(btn.frame.origin.x+10+245, btn.frame.origin.y+55, 44, 44) inView:self.splitViewController.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];//
}
Try out below code for UIPicker View in iPad
-(IBAction)tDriveBtnPressed:(id)sender
{
NSDateFormatter *df = [[NSDateFormatter alloc] init];
df.dateStyle = NSDateFormatterMediumStyle;
txtDate.text = [NSString stringWithFormat:#"%#",
[df stringFromDate:[NSDate date]]];
[df release];
UIToolbar *pickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 300, 44)];
pickerToolbar.barStyle = UIBarStyleBlackOpaque;
[pickerToolbar sizeToFit];
NSMutableArray *barItems = [[NSMutableArray alloc] init];
UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:#selector(pickerDone:)];
[barItems addObject:doneBtn];
[doneBtn release];
[pickerToolbar setItems:barItems animated:YES];
[barItems release];
datePicker = [[UIDatePicker alloc] init];
datePicker.datePickerMode = UIDatePickerModeDate;
CGRect pickerRect = datePicker.bounds;
datePicker.bounds = pickerRect;
UIViewController* popoverContent = [[UIViewController alloc] init];
UIView* popoverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 344)];
popoverView.backgroundColor = [UIColor whiteColor];
datePicker.frame = CGRectMake(0, 44, 320, 300);
[datePicker addTarget:self action:#selector(dateChange:) forControlEvents:UIControlEventValueChanged];
[popoverView addSubview:pickerToolbar];
[popoverView addSubview:datePicker];
popoverContent.view = popoverView;
//resize the popover view shown
//in the current view to the view's size
popoverContent.contentSizeForViewInPopover = CGSizeMake(320, 244);
//create a popover controller
popoverController = [[UIPopoverController alloc] initWithContentViewController:popoverContent];
CGRect popoverRect = [self.view convertRect:[tDriveBtn frame]
fromView:[tDriveBtn superview]];
popoverRect.size.width = MIN(popoverRect.size.width, 100) ;
popoverRect.origin.x = popoverRect.origin.x;
// popoverRect.size.height = ;
[popoverController
presentPopoverFromRect:popoverRect
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
//release the popover content
[popoverView release];
[popoverContent release];
}
-(void)dateChange:(id)sender
{
NSDateFormatter *df = [[NSDateFormatter alloc] init];
df.dateStyle = NSDateFormatterMediumStyle;
txtDate.text= [NSString stringWithFormat:#"%#",
[df stringFromDate:datePicker.date]];
[df release];
}
- (void)pickerDone:(id)sender
{
NSDateFormatter *df = [[NSDateFormatter alloc] init];
df.dateStyle = NSDateFormatterMediumStyle;
txtDate.text= [NSString stringWithFormat:#"%#",
[df stringFromDate:datePicker.date]];
[df release];
if (popoverController != nil) {
[popoverController dismissPopoverAnimated:YES];
self.popoverController=nil;
}
}
I want a section of my table view to reload whenever the ViewWillAppear method is called, I've implemented this like so:
- (void)viewWillAppear:(BOOL)animated {
NSIndexPath* rowToReload = [NSIndexPath indexPathForRow:0 inSection:1];
reloadRows = [NSArray arrayWithObjects:rowToReload, nil];
[self.tableView reloadRowsAtIndexPaths:reloadRows withRowAnimation:UITableViewRowAnimationNone];
}
Here is the rowforsection method that indicates which content should appear in each tableview section:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(#"fadk");
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:#"PINGAS"];
[self.tableView setAlwaysBounceVertical:YES];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
reuseIdentifier:#"PINGAS"] autorelease];
cell.accessoryType = UITableViewCellAccessoryNone;
// if ([indexPath section] == 0) {
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 3, 300, 41)];
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(10, 0, 300, 120)];
UIView *paddingView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, 0)] autorelease];
paddingView.backgroundColor = [UIColor cyanColor];
// if ([indexPath row] == 0) {
if ([indexPath section] == 0) {
NSLog(#"0");
[cell addSubview:textField];
if ([indexPath row] == 0) {
textField.placeholder = #"Title";
}
else{
textField.placeholder = #"Location";
}
}
else if ([indexPath section] == 1) {
NSLog(#"1");
NSDateFormatter *formatter;
NSString *eSString1;
NSString *eEString2;
formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:#"h:mm a"];
cell.textLabel.text = #"Starts\nEnds";
cell.textLabel.numberOfLines = 2;
eSString1 = [formatter stringFromDate:eSTime];
eEString2 = [formatter stringFromDate:eEtime];
cell.detailTextLabel.text = [NSString stringWithFormat:#"%#\n%#", eSString1, eEString2];
cell.detailTextLabel.numberOfLines = 2;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
else{
NSLog(#"2");
[cell addSubview:textView];
}
textField.delegate = self;
textField.leftView = paddingView;
textField.leftViewMode = UITextFieldViewModeAlways;
textField.adjustsFontSizeToFitWidth = YES;
textField.textColor = [UIColor blackColor];
textField.keyboardType = UIKeyboardTypeAlphabet;
textField.returnKeyType = UIReturnKeyDone;
textField.backgroundColor = [UIColor clearColor];
textField.autocorrectionType = UITextAutocorrectionTypeNo; // no auto correction support
textField.autocapitalizationType = UITextAutocapitalizationTypeNone; // no auto capitalization support
textField.textAlignment = UITextAlignmentLeft;
textField.tag = 0;
//playerTextField.delegate = self;
textField.clearButtonMode = UITextFieldViewModeNever; // no clear 'x' button to the right
[textField setEnabled: YES];
[textField release];
textView.delegate = self;
textView.textColor = [UIColor blackColor];
textView.keyboardType = UIKeyboardTypeAlphabet;
textView.returnKeyType = UIReturnKeyDone;
textView.backgroundColor = [UIColor clearColor];
textView.autocorrectionType = UITextAutocorrectionTypeNo; // no auto correction support
textView.autocapitalizationType = UITextAutocapitalizationTypeNone; // no auto capitalization support
textView.textAlignment = UITextAlignmentLeft;
textView.tag = 0;
[textView release];
// }
}
return cell;
}
This works swimmingly the first load, and I after the first calling of viewWillAppear, but after that the section seems to recycle the data from the first load and the second load, and while it still enters the cellforrow section, it no longer goes into the section I call in the viewWIllAppear section.
The reload should be sandwiched between begin / end updates:
[self.tableView beginUpdates];
[self.tableView reloadRowsAtIndexPaths:reloadRows withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];
I have a table view controller like this, and when a row is clicked its colour will turn to blue, but I don't want it to, because I have a text field and a label in each row. How can I stop it from becoming blue like this?
This is my code for cell construction:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
CustomCellStudentData *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
// cell = [[[CustomCellStudentData alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
cell = [[[CustomCellStudentData alloc] initWithFrame:CGRectZero reuseIdentifier:nil] autorelease];
}
switch(indexPath.section)
{
case 0:
switch (indexPath.row)
{
case 0:
{
tfText[0] = [[UITextField alloc] initWithFrame:CGRectMake(125,15, 170, 40)];
cell.accessoryView = tfText[0];
tfText[0].delegate=self;
tfText[0].text =#"";
tfText[0].placeholder =#"<Student Name>";
cell.primaryLabel.text =#"Student Name: ";
}
break;
case 1:
{
tfText[1] = [[UITextField alloc] initWithFrame:CGRectMake(125,15, 170, 40)];
cell.accessoryView = tfText[1];
tfText[1].delegate=self;
tfText[1].placeholder =#"<Student Age>";
cell.primaryLabel.text =#"Student Age: ";
}
break;
case 2:
{
cell.primaryLabel.text =#"Gender: ";
segmentedControl = [[UISegmentedControl alloc] initWithItems:nil];
segmentedControl.segmentedControlStyle = UISegmentedControlStyleBezeled;
segmentedControl.frame = CGRectMake(100,10,200,30);
[segmentedControl insertSegmentWithTitle:#"Male" atIndex:0 animated:YES];
[segmentedControl insertSegmentWithTitle:#"Female" atIndex:1 animated:YES];
segmentedControl.selectedSegmentIndex = 1;
segmentedControl.tintColor = [UIColor purpleColor];
segmentedControl.backgroundColor = [UIColor whiteColor];
[segmentedControl setMomentary:YES];
[segmentedControl addTarget:self action:#selector(segmentSwitch:) forControlEvents:UIControlEventValueChanged];
cell.accessoryView =segmentedControl;
//[self.view addSubview:segmentedControl];
/*
segmentedControl = [[UISegmentedControl alloc] initWithItems:nil];
[segmentedControl insertSegmentWithTitle:#"Male" atIndex:0 animated:YES];
[segmentedControl insertSegmentWithTitle:#"Female" atIndex:1 animated:YES];
segmentedControl.segmentedControlStyle = UISegmentedControlStylePlain;
segmentedControl.frame = CGRectMake(100,10,200,30);
[segmentedControl setMomentary:YES];
[segmentedControl addTarget:self action:#selector(segmentSwitch:) forControlEvents:UIControlEventValueChanged];
*/
}
break;
case 3:
{
tfText[3] = [[UITextField alloc] initWithFrame:CGRectMake(125,15, 170, 40)];
cell.accessoryView = tfText[3];
tfText[3].delegate=self;
tfText[3].placeholder =#"<DD/MM/YYYY>";
cell.primaryLabel.text =#"Date Of Birth: ";
}
break;
case 4:
{
tfText[5] = [[UITextField alloc] initWithFrame:CGRectMake(125,15, 170, 40)];
cell.accessoryView = tfText[5];
tfText[5].delegate=self;
tfText[5].placeholder =#"<Blood Group>";
cell.primaryLabel.text =#"Blood Group: ";
}
break;
case 5:
{
tfText[6] = [[UITextField alloc] initWithFrame:CGRectMake(125,15, 170, 40)];
cell.accessoryView = tfText[6];
tfText[6].delegate=self;
tfText[6].placeholder =#"<Address>";
cell.primaryLabel.text =#"Address: ";
}
break;
default:
break;
}
Actually it is only one line of code...
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
Inside your method i.e cellforrowatindexpath add the below code
UIView *bckv = [[UIView alloc] initWithFrame:CGRectMake(cell.frame.origin.x, cell.frame.origin.y, cell.frame.size.width,cell.frame.size.height)];
bckv.backgroundColor = [UIColor colorWithRed:106/256.0 green:108.0/256.0 blue:107.0/256.0 alpha:0.0];
cell.selectedBackgroundView=bckv;
[bckv release];
OR
cell.selectionStyle=UITableViewCellSelectionStyleNone;
Hope it helps......
cell.selectionStyle = UITableViewCellSelectionStyleNone;