Giter Site home page Giter Site logo

Comments (6)

ZionChang avatar ZionChang commented on June 23, 2024 1

Please try

class CustomPopoverTableViewController: PopoverTableViewController {
    
    override public var preferredContentSize: CGSize {
        get {
            return CGSize(width: 250, height: 250)
        }
        set {
            super.preferredContentSize = newValue
        }
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.isScrollEnabled = true
    }
    
    override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 100
    }
    
}

And then exchange the PopoverTableViewController with CustomPopoverTableViewController

from popoverkit.

ZionChang avatar ZionChang commented on June 23, 2024

The height of PopoverTableViewController is depending on preferredContentSize which is calculated by rows of tableview

from popoverkit.

thedahiyaboy avatar thedahiyaboy commented on June 23, 2024

Please check the below screen shots for iPhone & iPad of popovercontroller. In iPad list is cropped and tableView is not scrolling.

P.S. I am using the same TableView that is in the demo that you have provided with same model data structure.

and for row height I am doing below code

public override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return DeviceType.isIPad() ? 50 : 40
    }

If i Change the height from here then popover tableView row height will be changed as expected but the Popover Height is not changed and it cropped the options in Popover.

ipad
iphone

from popoverkit.

ZionChang avatar ZionChang commented on June 23, 2024

I have checked out, I didn't find any problem, sorry. If you really want to change the height of popover, you can inherit PopoverTableViewController, and override preferredContentSize and heightForRow. Finally if there has any problem, you can send me demo using email.

from popoverkit.

thedahiyaboy avatar thedahiyaboy commented on June 23, 2024

Please check the Repo.

I have tried this below line to change the contentsize but there is no effect (for dummy check).
vc.preferredContentSize = CGSize(width: 250, height: 500)

I have observed one more thing, if I removed heightForRowAt then all titles are shown perfectly and popOver kit width & height will be based on the title size.

I want popover kit size different in iPhone and iPad.

from popoverkit.

thedahiyaboy avatar thedahiyaboy commented on June 23, 2024

Please try

class CustomPopoverTableViewController: PopoverTableViewController {
    
    override public var preferredContentSize: CGSize {
        get {
            return CGSize(width: 250, height: 250)
        }
        set {
            super.preferredContentSize = newValue
        }
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.isScrollEnabled = true
    }
    
    override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 100
    }
    
}

And then exchange the PopoverTableViewController with CustomPopoverTableViewController

Working as expected , Thanks

from popoverkit.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.