Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Return correct view controllers? #47

Closed
HackShitUp opened this issue Dec 27, 2016 · 2 comments
Closed

Question: Return correct view controllers? #47

HackShitUp opened this issue Dec 27, 2016 · 2 comments

Comments

@HackShitUp
Copy link

HackShitUp commented Dec 27, 2016

How do I return the correct view controllers? Here's my code that loops through the objects:

`
// Loop through objects to determine which view controller to show
for postObject in stackObjects {

        print("***STACKOBJECTS:***\(stackObjects)\n****")
        
        if postObject.value(forKey: "contentType") as! String == "tp" {
            // I) TEXT POST
            textPostObject.append(postObject)
            let textPostVC = self.storyboard?.instantiateViewController(withIdentifier: "textPostVC") as! TextPost
            // Append VC
            postControllers.append(textPostVC)
            
        } else if postObject.value(forKey: "contentType") as! String == "ph" {
            // II) PHOTO
            photoAssetObject.append(postObject)
            let photoVC = self.storyboard?.instantiateViewController(withIdentifier: "photoAssetVC") as! PhotoAsset
            // Append VC
            postControllers.append(photoVC)
            
        } else if postObject.value(forKey: "contentType") as! String == "pp" {
            // III) PROFILE PHOTO
            proPicObject.append(postObject)
            otherObject.append(postObject.value(forKey: "byUser") as! PFUser)
            otherName.append(postObject.value(forKey: "username") as! String)
            let proPicVC = self.storyboard?.instantiateViewController(withIdentifier: "profilePhotoVC") as! ProfilePhoto
            // Append VC
            postControllers.append(proPicVC)
            
        } else if postObject.value(forKey: "contentType") as! String == "sh" {
            // IV) SHARED POST
            sharedObject.append(postObject)
            let sharedPostVC = self.storyboard?.instantiateViewController(withIdentifier: "sharedPostVC") as! SharedPost
            // Append VC
            postControllers.append(sharedPostVC)
            
        } else if postObject.value(forKey: "contentType") as! String == "sp" {
            // V) SPACE POST
            spaceObject.append(postObject)
            otherObject.append(postObject.value(forKey: "toUser") as! PFUser)
            otherName.append(postObject.value(forKey: "toUsername") as! String)
            let spacePostVC = self.storyboard?.instantiateViewController(withIdentifier: "spacePostVC") as! SpacePost
            // Append VC
            postControllers.append(spacePostVC)
            
        } else if postObject.value(forKey: "contentType") as! String == "itm" {
            // VI) MOMENT
            itmObject.append(postObject)
            let itmVC = self.storyboard?.instantiateViewController(withIdentifier: "itmVC") as! InTheMoment
            // Append VC
            postControllers.append(itmVC)
            
        } else if postObject.value(forKey: "contentType") as! String == "vi" {
            // VII) VIDEO
            videoObject.append(postObject)
            let videoVC = self.storyboard?.instantiateViewController(withIdentifier: "videoVC") as! VideoAsset
            // Append VC
            postControllers.append(videoVC)
            
        }
        
    }`

Where postControllers, is an array that holds all the UIViewControllers. HOWEVER, even with the correct startingIndex, it doesn't load the correct UIViewController. How do I handle this correctly?

@HackShitUp
Copy link
Author

HackShitUp commented Dec 28, 2016

Also, this is in the following function:
func viewControllerData() -> [UIViewController] { }

The UITableViewControllers DO return, but not the correct ones. I took another look and found out that it only fetches 7 view controllers? I suspect it might be because of the setupViewController function in EZSwipeController, but I'm not sure yet. Also, the sizing constraints are very off - the UINavigationBar is customized and initialized by the parent view controller and returned accordingly to the 7 different types of UITableViewControllers, but every time I swipe down to the next view controller, the height of the navigation bar is increased on its own. I can share some screenshots if you'd like.

@HackShitUp
Copy link
Author

bump because I need help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant