2014-01-28 298 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