39668

How to Handle the UiTableviewCell textfields?

Question:

i have custom tableview cell in custom cell i am taking the two textfield(First name,Age).My problem is how to handle the these textfields.if user not fill these these details we show the alert, per suppose user fill the details how to fetch the data. Bellow is my tableview custom cell image. <a href="https://i.stack.imgur.com/p5GwF.png" rel="nofollow"><img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/p5GwF.png" data-original="https://i.stack.imgur.com/p5GwF.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

Answer1:

Add all textfields to NSMutableArray in cellForRowAtIndexPath

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ [mutableArrary addObject:cell.yourTextField]; return cell; }

after that in your button action do like this:

-(IBAction)buttonAction:(id)sender{ for (UITextField*textField in mutableArray){ NSLog(@"%@",textField.text); } }

Check there if any text is coming as nil then you can show alert like fill all details.

Recommend

  • TableView loading more cell when scroll to bottom
  • Error: Variable with getter/setter cannot have an initial value
  • TableView, how change the cell default blue color
  • UITableView cell goes blank when scrolling
  • Using Variables in Set Analysis Expressoin
  • How to Wrap words in UILabel
  • no @interface for 'UITableView' declares the selector 'initWithStyle:reuseIdentifiers
  • Check if a UITableViewCell is completely visible
  • how to set image's top and bottom in same size for android?
  • Pie-in-pie (Donut) charts
  • Java tree with columns
  • Why won't my UITableViewCell deselect and update its text?
  • Best approach for UITableViewCell with both a left and right label
  • Xcode duplicated devices bug
  • How to get value from merged-cells in Excel document using OpenXML and C#
  • Can I have a variable number of URI parameters or key-value pairs in Laravel 4?
  • Ruby on Rails App deployed to heroku showing “We're sorry, but something went wrong”
  • Julia: How to give multiple workers access to functions that are 'include(…)' into a modul
  • JPA flush vs commit
  • as3-flash: any way to access all the instances placed in different frames from document class?
  • Execute scripts AJAX returns
  • How to use JavaScript to determine whether a file exists in a directory?
  • Does it make sense to call System.gc() and Thread.sleep() when working on Bitmaps?
  • Caching attributes in superclass
  • Functions in global context
  • FileReader+canvas image loading problem
  • javascript inside java/jsp code
  • Sending data from AppleScript to FileMaker records
  • htaccess rewriting URLs with multiple forward slashes
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • Compare two NSDates in iPhone
  • KeystoneJS: Relationships in Admin UI not updating
  • AngularJs get employee from factory
  • trying to dynamically update Highchart column chart but series undefined
  • Load html files in TinyMce
  • embed rChart in Markdown
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app