-
Notifications
You must be signed in to change notification settings - Fork 271
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
How can I customize ViewController with your Presentr #4
Comments
You can present any custom View Controller you create either through code, xibs or interface builder. Are you referring to the AlertViewController I include in the framework? If so, it is currently only customizable in that you can supply the title text, body text and 1 or 2 buttons which have a title, an action block and a style, which can be .Default, .Destructive or .Cancel, which use green, red or gray text color. What kinds of things would you like to be able to customize on the AlertViewController? I could look into adding this in the next release. |
I mean how can I change the sizes, frames of the pop up, thanks |
Oh, got it! Right now the only presentation types (which deal with sizing and positioning the presented controller on screen) are the 4 included. Popup, Alert, TopHalf and BottomHalf. My idea was that that would be enough for the typical cases, and any other case which I missed could be added on via a pull request by someone else. But, it might be a good idea to have a "Custom" presentation type, which allows you to set the set the size and position, without having to change code inside the framework. I like this idea. Will get working on this for the next release. |
Done! You should be able to use a Custom Presentation Type in the new 0.1.6 release, which should be available via Cocoapods now. I will update the Readme to provide detailed instructions on how to create a custom presentation, but for now I'll share some example code for creating a 'Top Banner' type alert. let customPresenter: Presentr = {
let width = ModalSize.Full // Can still use Presentr's automatically calculated sizes
let height = ModalSize.Custom(size: 150) // But can use custom ones when needed
let center = ModalCenterPosition.CustomOrigin(origin: CGPoint(x: 0, y: 0))
// let center = ModalCenterPosition.Center // Could also use something like this
// let center = ModalCenterPosition.Custom(centerPoint: CGPoint(x: 50, y: 50)) // or this
let customType = PresentationType.Custom(width: width, height: height, center: center)
let customPresenter = Presentr(presentationType: customType)
customPresenter.transitionType = .CoverVerticalFromTop
customPresenter.roundCorners = false
return customPresenter
}() |
Wonderful. :-) Thanks! :-) |
Wonderful |
No description provided.
The text was updated successfully, but these errors were encountered: