Latest 1.4
Homepage https://github.com/tichise/PageSheetForm
License MIT
Platforms ios 8.0, requires ARC

PageSheetForm CocoaPods Version Platform License

PageSheetForm is a PageSheet style form.

Image

iPhone

PageSheetForm

iPad

PageSheetForm
PageSheetForm

Examples

Swift

let pageSheetFormController = PageSheetFormController.instantiate()
pageSheetFormController.setInitialText((self.baseTextView?.text)!)
pageSheetFormController.setTitleText("Title")
pageSheetFormController.setIsPreview(true)
pageSheetFormController.setPreviewPageTitle("Preview")
pageSheetFormController.setCancelButtonText("Cancel")
pageSheetFormController.setSendButtonText("Send")
// pageSheetFormController.setTitleSize(20) // default 15
// pageSheetFormController.setButtonSize(20) // default 15
pageSheetFormController.completionHandler = { sendText in

    if (sendText.characters.count > 20) {
        let alertController:UIAlertController = UIAlertController(title:nil, message: "The number of characters exceeds the upper limit. Please enter within 20 characters.", preferredStyle: UIAlertControllerStyle.alert)
        let cancelAction:UIAlertAction = UIAlertAction(title: "Close", style: UIAlertActionStyle.cancel, handler:{ (action:UIAlertAction!) -> Void in
        })
        alertController.addAction(cancelAction)
        pageSheetFormController.present(alertController, animated: true, completion: nil)
        return
    }

    if (sendText.characters.count == 0) {
        let alertController:UIAlertController = UIAlertController(title:nil, message: "It is not input. Please enter.", preferredStyle: UIAlertControllerStyle.alert)
        let cancelAction:UIAlertAction = UIAlertAction(title: "Close", style: UIAlertActionStyle.cancel, handler:{ (action:UIAlertAction!) -> Void in
        })
        alertController.addAction(cancelAction)
        pageSheetFormController.present(alertController, animated: true, completion: nil)
        return
    }

    // success
    self.baseTextView?.text = sendText

    self.dismiss(animated: true, completion: nil)
};

let navigationController = UINavigationController(rootViewController: pageSheetFormController)
navigationController.modalPresentationStyle = UIModalPresentationStyle.pageSheet
present(navigationController, animated: true, completion: nil)

ObjectiveC

@import PageSheetForm;

__weak PageSheetFormController *pageSheetFormController = [PageSheetFormController instantiate];
    [pageSheetFormController setIsPreview:true];
    [pageSheetFormController setPreviewPageTitle:@"Preview"];
    [pageSheetFormController setTitleText:@"Title"];
    [pageSheetFormController setCancelButtonText:@"Cancel"];
    [pageSheetFormController setSendButtonText:@"Send"];
    [pageSheetFormController setCompletionHandler:^(NSString *sendText) {

        if ([sendText length] > 5) {
            UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:@"The number of characters exceeds the upper limit. Please enter within 20 characters." preferredStyle:UIAlertControllerStyleAlert];
            UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {}];
            [alertController addAction:cancelAction];
            [pageSheetFormController presentViewController:alertController animated:YES completion:nil];

            return;
        }

        if ([sendText length] == 0) {
            UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:@"It is not input. Please enter.." preferredStyle:UIAlertControllerStyleAlert];
            UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {}];
            [alertController addAction:cancelAction];
            [pageSheetFormController presentViewController:alertController animated:YES completion:nil];

            return;
        }

        [self dismissViewControllerAnimated:true completion:nil];
    }];

    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:photoPreviewViewController];
    [navigationController setModalPresentationStyle:UIModalPresentationPageSheet];
    [self presentViewController:pageSheetFormController animated:true completion:nil];

Installation (CocoaPods)

pod PageSheetForm

or

pod 'PageSheetForm', :git => 'https://github.com/tichise/PageSheetForm.git'

Latest podspec

{
    "name": "PageSheetForm",
    "version": "1.4",
    "license": "MIT",
    "summary": "PageSheetForm is a PageSheet style form.",
    "homepage": "https://github.com/tichise/PageSheetForm",
    "social_media_url": "http://twitter.com/tichise",
    "authors": "Takuya Ichise",
    "source": {
        "git": "https://github.com/tichise/PageSheetForm.git",
        "tag": "1.4"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Sources/*.swift",
    "requires_arc": true,
    "resource_bundles": {
        "Storyboards": [
            "Storyboards/*.storyboard"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This