Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: f811900c67
Fetching contributors…

Cannot retrieve contributors at this time

file 76 lines (52 sloc) 1.758 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
//
// SSRatingPickerViewController.m
// SSToolkit
//
// Created by Sam Soffes on 2/3/11.
// Copyright 2011 Sam Soffes. All rights reserved.
//

#import "SSRatingPickerViewController.h"
#import "SSRatingPickerScrollView.h"
#import "SSRatingPicker.h"
#import "SSTextField.h"
#import "SSTextView.h"
#import "UIScreen+SSToolkitAdditions.h"

@interface SSRatingPickerViewController ()
@property (nonatomic, strong, readonly) SSRatingPickerScrollView *scrollView;
@end

@implementation SSRatingPickerViewController

#pragma mark - Accessors

- (SSRatingPickerScrollView *)scrollView {
return (SSRatingPickerScrollView *)self.view;
}


- (SSRatingPicker *)ratingPicker {
return self.scrollView.ratingPicker;
}


- (SSTextField *)titleTextField {
return self.scrollView.titleTextField;
}


- (SSTextView *)reviewTextView {
return self.scrollView.reviewTextView;
}


#pragma mark - UIViewController

- (void)loadView {
self.view = [[SSRatingPickerScrollView alloc] initWithFrame:CGRectZero];
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
}
return YES;
}


- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.titleTextField becomeFirstResponder];
}


#pragma mark - SSViewController

- (void)layoutViewsWithOrientation:(UIInterfaceOrientation)orientation {

CGSize size = [[UIScreen mainScreen] boundsForOrientation:orientation].size;
BOOL landscape = UIInterfaceOrientationIsLandscape(orientation);
size.height -= landscape ? 214.0f : 280.0f;

self.view.frame = CGRectMake(0.0f, 0.0f, size.width, size.height - 10.0f);
}

@end
Something went wrong with that request. Please try again.