logo
down
shadow

How to Set a tag Value in UITAbleView Cell and Pass It into URL in iOS?


How to Set a tag Value in UITAbleView Cell and Pass It into URL in iOS?

By : Mark Francis
Date : November 18 2020, 11:13 AM
Does that help The problem is that you're setting intValue to 1 in your cellForRowAtIndexPath: method:
code :
if ([SelectedRows containsObject:obj])
{
    cell.accessoryType = UITableViewCellAccessoryCheckmark;
    cell.tag=1;
    intValue=cell.tag;
    NSLog(@"Tag %d",intValue);
}
self.tagArray = [[NSMutableArray alloc] init];
for (int i = 0 ; i < 9 ; i ++) {
    [self.tagArray addObject:[NSNumber numberWithInt:0]];
}
-(CategoryCustumCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    // ...

    NSNumber *obj = [NSNumber numberWithInteger:indexPath.section];
    if ([SelectedRows containsObject:obj])
    {
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
        cell.tag=1;
    }
    else
    {
        cell.accessoryType = UITableViewCellAccessoryNone;
        cell.tag=0;
    }

    [self.tagArray replaceObjectAtIndex:indexPath.section withObject:[NSNumber numberWithInteger:cell.tag]];
    return cell;
}
- (void)performSave {

    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.janvajevu.com/webservice/insert_gcm.php?gcm_id=%@&category1=%@&category2=%@&category3=%@&category4=%@&category5=%@&category6=%@&category7=%@&category8=%@&category9=%@", uniqueIdentifier, self.tagArray[0], self.tagArray[1], self.tagArray[2], self.tagArray[3], self.tagArray[4], self.tagArray[5], self.tagArray[6], self.tagArray[7], self.tagArray[8]]];    
}


Share : facebook icon twitter icon
Pass data from a selected cell in UITableView

Pass data from a selected cell in UITableView


By : Tahir
Date : March 29 2020, 07:55 AM
hop of those help? Why pass the index of the row?
Pass the information the other controller need to use.
code :
DetailGameController *detail = [self.storyboard instantiateViewControllerWithIdentifier:@"Detail"];
NSUInteger row = [indexPath row];
detail.someProperty = [photoTitles objectAtIndex:row];
detail.someOtherProperty = // other interesting elements ;
How to pass a UIImageView from UITableView (custom cell) to DetailViewController?

How to pass a UIImageView from UITableView (custom cell) to DetailViewController?


By : Pavonis
Date : March 29 2020, 07:55 AM
To fix the issue you can do I'm tearing my hair out over this one. I'm trying to pass an image URL from my TableViewController to my DetailViewController (FullArticleViewController) so that I can set the UIImageView, and nothing I try seems to be working. See my code below: , MyTableViewController.m
code :
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    FullArticleViewController *detailViewController = [[FullArticleViewController alloc]
                                    initWithNibName:@"FullArticleViewController" bundle:nil];
    if ([searchResults count]) {
        detailViewController.title = [[searchResults objectAtIndex:indexPath.row] objectForKey:@"node_title"];
        detailViewController.articleDetail = [searchResults objectAtIndex:indexPath.row];
        detailViewController.cellImageLink = searchResults[indexPath.row][@"Image"][@"filename"];
    } else {
        detailViewController.title = [[Doctors objectAtIndex:indexPath.row] objectForKey:@"node_title"];
        detailViewController.articleDetail = [Doctors objectAtIndex:indexPath.row];
        detailViewController.cellImageLink =  Doctors[indexPath.row][@"Image"][@"filename"];
    }
        NSLog(@"cellImageLink = %@", detailViewController.cellImageLink);
        [self.navigationController pushViewController:detailViewController animated:YES]; 
}
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    NSLog(@"cellImageLink = %@", self.cellImageLink);

    featureImage = [[UIImageView alloc] init];
    //maybe set the frame here?
    [self.featureImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://domainnamehere.com/%@",cellImageLink]]];

    [scroller setScrollEnabled:YES];
    [scroller setContentSize:CGSizeMake(320, 5000)];

    firstnameLabel.text = [articleDetail objectForKey:@"node_title"];
    descriptionLabel.text = [articleDetail objectForKey:@"Opening Paragraph"];
    bodyLabel.text = [articleDetail objectForKey:@"Body"];
}
UItableview cell Dyanmic height with UItableview inside the UItableview cell

UItableview cell Dyanmic height with UItableview inside the UItableview cell


By : HrElmo
Date : March 29 2020, 07:55 AM
Any of those help Finally i solved my problem in this way.
Instead of multiple tableviews,i went for multiple sections.I kept Feed Message/image section header and comments as rows for that section.That work's great.
how to pass Values from ViewController to UITableView custom cell class

how to pass Values from ViewController to UITableView custom cell class


By : umut
Date : March 29 2020, 07:55 AM
will be helpful for those in need i have a VC name RestaurantViewController it has custom cell for itemName ItemPrice and there are three button + , - and add their actions are in customCellClass now when a user select the quantity by setting with plus/minus and then hit the add button the whole data should go to the CartVC but not push until user selects the cart icon on main menu. , Follow Below Code:- Using Protocol Delegate
code :
//1
//Create protocol

protocol TableViewCellDelegate {
    func addTapped(cell: TableViewCell)
}

//2
//Create instance
class TableViewCell: UITableViewCell {

var delegate: TableViewCellDelegate?

….

@IBAction func addAction(_ sender: Any) {
    delegate?.addTapped(cell: self)
}
}


//3

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    // create a new cell if needed or reuse an old one
    let cell: TableViewCell = tableView.dequeueReusableCell(withIdentifier: “cell”, for: indexPath) as! TableViewCell
    cell.delegate = self
}

 //4
extension ViewController: TableViewCellDelegate {
func addTapped(cell: TableViewCell) {

 }
}
How to pass state of UISwitch in prototype cell back to UITableView

How to pass state of UISwitch in prototype cell back to UITableView


By : Giles Holt
Date : March 29 2020, 07:55 AM
hope this fix your issue I have a UISwitch in a prototype cell that I can't figure out how to pass the state back to my UITableView. I need the state of the switch passed back to update an object to reflect the new state. , First you need to create the call back in table view cell.
code :
 class ProgrammeToogleTableViewCell: UITableViewCell {

   @IBOutlet weak var switchUI: UISwitch!

   // callback to get action of switch status
   var callBackSwitchState:((Bool) -> (Void))?

  // Create action for value change event on switch
   @IBAction func switchAtValueChanged(programmeToggle: UISwitch) {
     callBackSwitchState?(programmeToggle.isOn)
   }
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> 
  UITableViewCell {
   guard let cell = tableView.dequeueReusableCell(withIdentifier: 
     "ProgrammeToggleTableViewCell", for: indexPath) as? ProgrammeToogleTableViewCell 
     else { return UITableViewCell() }
    cell.tag = indexPath.row

    // Implement the callback to get the status of switch:
    cell.callBackSwitchState = { isOn in
    print("Your Switch status = \(isOn)")

    // isOn is your switch status. You can update your object here.
   }

 // Your other code here ....
 return cell
}
Related Posts Related Posts :
  • NSRunLoop API difference
  • Is it possible to inject custom settings into my iOS application "Notifications" settings dialog?
  • UIAlertview not accepting string as message
  • Axis change of stackView giving layout error
  • How to use AVAssetResourceLoader?
  • How to write block definition using properties?
  • iOS connect/reconnect to Bluetooth device when using external-accessory and MFi
  • Saving XMPP Multi User chat messages through XMPP MessageArchiving in iOS
  • Deciding iOS version: pros and cons
  • iOS: Resigned app cannot access keychain through security API
  • How can I set To and Subject fields in an E-Mail being sent by UIDocumentInteractionController?
  • Updating uilabel in view controller underneath another
  • Maximum time Intervel for NSTimer
  • Delete Core Data Entry from Table View Controller
  • How to unload UIViewcontroller from memory?
  • Compressing UIImage as Far as Possible?
  • Optimizing workflow to update internally owned cocoapods dependencies?
  • Formatting an NSDate with Abbreviated Month/Day Names
  • I'm creating a quiz game with 4 answers and I want to add score
  • Tap Gesture to Hide Navigation Bar, Tab Bar, and Status Bar
  • FBSessionStateClosedLoginFailed when I am logged in through Settings
  • CGRect positioning according to center point
  • iOS: Update table view datasource with animations without core data
  • iOS : Where to start for AliPay integration?
  • Routing App Coverage File missing but not needed?
  • Drawing on a zoomable view
  • Append NSStrings and NSNumber to NSMutableArrays and make NSMutable dictionary
  • Terminating app due to uncaught exception 'NSRangeException' when calling dequeueReusableCellWithReuseIdentifier:forInde
  • Collision without physics (Cocos2D + Box2D iOS)
  • Creating a percentage based iOS layout
  • Update tableView row from AppDelegate Swift 4
  • Assigning return value of a class method to a variable error
  • how to display circular progress in delphi ios apps?
  • I can't figure how to fix this Expected identifier or '('
  • How to Test APIs in Swift 4?
  • Link error /Build/Products/Debug-iphonesimulator file not found
  • working with a very large JSON object in iOS
  • Turn off part of the iPhone Screen
  • Phonegap 3.0 app with facebook login using xCode
  • How to add interstitial admob ads to my ios project
  • adding tapku calendar to ios app
  • Add an alertcontroller in a global swift file?
  • Take square image with Cordova (Phonegap) Camera API?
  • Amazon S3 policy allowing only upload not overwrite
  • How to change the UILabel content by tapping?
  • Adding checkmark to selected table cell also checks another table cell
  • UICollectionView cellForItemAtIndexPath indexPath row is nil
  • Resize and set quality on JPEG image while retaining EXIF in iOS
  • How to push rootviewcontroller in Ios
  • How to add UIBarbuttonItem at centre on UInavigationbar in iOS
  • Would this IOS device test crash be expected
  • PickerView not showing any values
  • How to set root view controller in storyboard animated with navigation controller programmatically
  • Can anyone suggest me the effective way to deal with s3 upload fail because of timezone difference issue?
  • Getting list of files in documents folder
  • Error while using Realm Object as a singleton. Is it a good idea?
  • inserting into SQLite database
  • More nodes than I should
  • Facebook IOS SDK navigate to another controller after login not working
  • Swift Array - use "Contains" of type AnyObject
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org