logo
down
shadow

UICollectionViewCell sending data to another viewController


UICollectionViewCell sending data to another viewController

By : user2952558
Date : November 19 2020, 01:01 AM
this will help The problem is that you are using wrong property of segue. The identifier is used for performSegueWithIdentifier:. You use destinationViewController to get your destination and check it like this [segue.destinationViewController isKindOfClass:NSClassFromString(@"PhotoDetailsViewController")]
code :


Share : facebook icon twitter icon
Sending data from one ViewController to another.

Sending data from one ViewController to another.


By : Aishwarya Radhakrish
Date : March 29 2020, 07:55 AM
like below fixes the issue I have got two ViewController: , Using delegate:
In TestAppViewController.h:
code :
   @protocol messageDelegate <NSObject>
    @optional
    -(void)test:(NSString*)str;
    @end
    @interface SecondViewController : NSString
    @property (nonatomic, assign) id <messageDelegate> delegate;
    @end
-(void)readyToSend
{
    [self.delegate test:@"Hello world!"];

}
@interface ViewController : UIViewController<messageDelegate>
@end
- (void)viewDidLoad {
TestAppViewController * testAppViewController = [[TestAppViewController alloc] init];
testAppViewController.delegate = self;
}
-(void) test:(NSString*)str{
NSLog(@"%@,str");
}
ViewController not properly sending over NSURL data to Destination ViewController

ViewController not properly sending over NSURL data to Destination ViewController


By : user2022801
Date : March 29 2020, 07:55 AM
This might help you When a user taps a cell, I want itemURL to be set to that cells "Item URL" property. Once it does this, it should then send over the itemURL in prepareForSegue over to WebViewController, as I've attempted to do. When I have WebViewController NSLog the itemURL property however, it comes up as null. How can I make sure the value is sent over properly? , In your didSelectRowForIndexPath: instead of
code :
NSURL *itemURL = _matchCenterArray[indexPath.section][@"Top 3"][indexPath.row][@"Item URL"];
self.itemURL = _matchCenterArray[indexPath.section][@"Top 3"][indexPath.row][@"Item URL"];
How to transition a UICollectionViewCell via a button to another ViewController?

How to transition a UICollectionViewCell via a button to another ViewController?


By : MrEvanJ
Date : March 29 2020, 07:55 AM
seems to work fine The problem is that your button's target is the cell, and so the buttonPressed action function is located in the cell. That's a pretty silly thing to do, because (as you rightly say) you cannot call present without a view controller to send it to.
What I would have done is set the button's target/selector in cellForItemAt:. That way, self is the view controller and we can set the target to self. But you didn't do that!
code :
var responder : UIResponder = self
responder = responder.next
var responder : UIResponder = self
repeat { responder = responder .next } while !(responder is UIViewController)
let vc = responder as! UIViewController
vc.present( // ...
UICollectionViewCell Segue to new ViewController

UICollectionViewCell Segue to new ViewController


By : user1881019
Date : March 29 2020, 07:55 AM
hop of those help? I had a UITapGesture used for resigning the keyboard connected to the collection view. I was more than 100% certain I had already tried deleting the gesture and the code for it. Apparently I had not deleted it fully because I went back and tried again and this solved the issue. Tap Gestures inside of collection views sit over the cells causing them not to be selected on touch.
The solution was, DO NOT have a UITapGesture in your UICollectionView.
How can I go back to the previous ViewController from UICollectionViewCell?

How can I go back to the previous ViewController from UICollectionViewCell?


By : Zedimus
Date : March 29 2020, 07:55 AM
With these it helps I would suggest add a callback in ViewCell for such small interaction as below,
code :
class ViewCell: UICollectionViewCell {

@IBOutlet weak var lblOutlet: UILabel!
@IBOutlet weak var contentViewOutlet: UIView!

override func awakeFromNib() {
    super.awakeFromNib()
    // Initialization code
}

public var dismiss: (()-> Void)? = nil

@IBAction func btnBack(_ sender: UIButton) {
    self.dismiss?()
}
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    let cell: ViewCell = // Your code to dequeue cell
    cell.dismiss = { [weak self] in
         self?.dismiss(animated: true, completion: nil) // OR Pop whatever
    }
}
Related Posts Related Posts :
  • 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
  • Sidebar menu with indicate navigationbar on iOS
  • Programmatically set size of UIView from Storyboard
  • Navigation bar blink
  • Web services issue on POST method
  • Parse.com error 'Method not allowed when Pinning is enabled.' when I use a PFQueryTableViewController subclass
  • Swift can't send URLRequest at all?
  • No Provisiong profiles with a valid signing identity were found and Failed to locate or generate matching signing assets
  • iOS: how to set httponly flag for NSHTTPCookie
  • How to get the mac address of a beacon in objective-c without knowing its UUID, major and minor values?
  • tableView is not showing data from JSON in swift
  • iTunes reject app for date of birth
  • SWIFT reporting "Extra argument in call" - works in Playground
  • save data depending on passed value in swift
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org