2014-01-28 77 views
0

我有以下的应用程序,我已经实现了一个滚动视图(图像轮廓上的故事板层次:电子滚动视图不滚动

Hierarchy of storyboard

我已经关闭了自动布局,如严重这里的帖子似乎表明这将创建一个问题

这里是我的.h文件:

#import <UIKit/UIKit.h> 
#import <MessageUI/MessageUI.h> 
#import <MessageUI/MFMailComposeViewController.h> 
#import <AssetsLibrary/ALAsset.h> 
#import <AssetsLibrary/ALAssetRepresentation.h> 
#import <ImageIO/CGImageSource.h> 
#import <ImageIO/CGImageProperties.h> 
#import <CoreLocation/CoreLocation.h> 



@interface DobInAHoonViewController : UIViewController<UIImagePickerControllerDelegate, UINavigationControllerDelegate, MFMailComposeViewControllerDelegate, UITextFieldDelegate, CLLocationManagerDelegate> 
{ 
    IBOutlet UIPickerView *vehiclePickerView; 
    UIImagePickerController *picker1; 
    UIImagePickerController *picker2; 
    UIImage *image; 
    IBOutlet UIImageView *imageView; 
    CLLocationManager *locationManager; 
    CGFloat animatedDistance; 

} 
@property (strong, nonatomic) IBOutlet UIImageView *BackgroundImage; 
@property (strong, nonatomic) IBOutlet UIScrollView *scrollView; 
@property (strong, nonatomic) NSString *Latitude; 
@property (strong, nonatomic) NSString *longditute; 
@property (strong, nonatomic) NSArray *toRecipients; 
@property (strong, nonatomic) ALAssetsLibrary *assetsLibrary; 
@property (strong, nonatomic) NSMutableArray *groups; 


@property (nonatomic, retain) IBOutlet UITextField *vehilceMake; 
@property (nonatomic, retain) IBOutlet UITextField *vehilceColour; 
@property (nonatomic, retain) IBOutlet UITextField *regoNumber; 
@property (nonatomic, retain) IBOutlet UITextField *location; 
@property (nonatomic, retain) IBOutlet UITextField *additionalInfo; 
@property (nonatomic, retain) IBOutlet UITextField *vehicleType; 


- (IBAction)takePhoto; 
-(IBAction)chooseExisting; 
-(IBAction)actionEmailComposer; 
-(IBAction)textFileReturn:(id)sender; 
-(IBAction)DismissKeyboard:(id)sender; 
@end 

和我的.m文件:

#import "DobInAHoonViewController.h" 

@interface DobInAHoonViewController() 



@end 

@implementation DobInAHoonViewController 
@synthesize BackgroundImage; 
@synthesize vehilceColour; 
@synthesize vehilceMake; 
@synthesize regoNumber; 
@synthesize Latitude; 
@synthesize location; 
@synthesize longditute; 
@synthesize additionalInfo; 
@synthesize toRecipients; 
@synthesize assetsLibrary; 
@synthesize groups; 
@synthesize vehicleType; 
@synthesize scrollView; 



static const CGFloat KEYBOARD_ANIMATION_DURATION = 0.3; 
static const CGFloat MINIMUM_SCROLL_FRACTION = 0.2; 
static const CGFloat MAXIMUM_SCROLLFRACTION = 0.8; 
static const CGFloat PORTRAIT_KEYBOARD_HEIGHT = 216; 
static const CGFloat LANDSCAPE_KEYBOARD_HEIGHT = 140; 




-(BOOL)textFieldShouldReturn:(UITextField *)textField 
{ 
    [vehilceMake resignFirstResponder]; 
    [vehilceMake resignFirstResponder]; 
    [vehilceColour resignFirstResponder]; 
    [location resignFirstResponder]; 
    [additionalInfo resignFirstResponder]; 
    [regoNumber resignFirstResponder]; 
    return YES; 
} 


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 
{ 
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 
    if (self) { 
     // Custom initialization 
    } 
    return self; 
} 






- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view. 

    [self.scrollView setScrollEnabled:YES]; 
    [self.scrollView setContentSize:(CGSizeMake(320, 1000))]; 


    locationManager = [[CLLocationManager alloc]init]; 
    toRecipients = [[NSArray alloc]initWithObjects:@"[email protected]", nil]; 

    BackgroundImage.alpha = 0.3; 
    static int emergAlertCounter; 
    if (emergAlertCounter <1) { 


    UIAlertView *emergencyAlert = [[UIAlertView alloc] 
           initWithTitle:@"NOTE" message:@"Do not endanger your life to dob in a hoon. If your life is threatened, or you are reporting an emergency situation, exit this app and dial '000' IMMEDIATLY!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
    [emergencyAlert show]; 
     emergAlertCounter = emergAlertCounter+1; 
    } 
} 

由于某种原因,当我运行应用程序时,滚动视图不滚动。我已将该属性设置为在界面构建器中滚动。

任何建议将不胜感激。

回答

1

您必须确保您的滚动视图小于320 x 1000且嵌入的视图大于320 x 1000