VimIy微民网,让世界倾听微民的声音! 设为首页 | 加入收藏 | 网站地图
当前位置:主页 > 大杂烩 >

【你们最专业了】 【求助】【ios大新手】Storyboard的问题。。

整理时间:2014-01-09 07:09 来源:www.vimiy.com 作者:编辑 点击:

【楼主】2014-01-07 08:29

» Storyboard的问题。。
    新手有几个问题
    有请大家帮忙啦
    ====================================
    我有一Storyboard 里面有一个WeightUIViewController
    
    1. 为啥example里面的ScrollView是灰色的我这个是白色的?
    
    
    2. 也是最大的问题啦..为啥测试的时候除了label就完全是空白的= =bbbb
    代码如下
    
    WeightUIViewController.m
    
    #import "WeightUIViewController.h"
    #import "Constrains.h"
    
    @interface WeightUIViewController () <UIPickerViewDelegate, UIPickerViewDataSource>
    
    @property (nonatomic, weak) IBOutlet UIScrollView *scrollView;
    @property (nonatomic, strong) UILabel *label;
    
    @property (nonatomic, strong) NSArray *pickerViewArray;
    @property (nonatomic, strong) UIPickerView *myPickerView;
    
    @end
    
    @implementation WeightUIViewController
    
    const CGFloat kOptimumPickerHeight = 216;
    const CGFloat kOptimumPickerWidth = 320;
    
    - (CGRect)pickerFrameWithSize:(CGSize)size
    {
     CGRect resultFrame;
    
     CGFloat height = size.height;
     CGFloat width = size.width;
    
     if (size.height < kOptimumPickerHeight)
     // if in landscape, the picker height can be sized too small, so use a optimum height
     height = kOptimumPickerHeight;
    
     if (size.width > kOptimumPickerWidth)
     // keep the width an optimum size as well
     width = kOptimumPickerWidth;
    
     resultFrame = CGRectMake(0.0, -1.0, width, height);
    
     return resultFrame;
    }
    
    - (void)createPicker
    {
     self.pickerViewArray = @;
    
     // note we are using CGRectZero for the dimensions of our picker view,
     // this is because picker views have a built in optimum size,
     // you just need to set the correct origin in your view.
     //
     _myPickerView = initWithFrame:CGRectZero];
    
     ;
     CGSize pickerSize = self.myPickerView.frame.size;
     self.myPickerView.frame = ;
    
     self.myPickerView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
    
     self.myPickerView.showsSelectionIndicator = YES; // note this is defaulted to NO
    
     // this view controller is the data source and delegate
     self.myPickerView.delegate = self;
     self.myPickerView.dataSource = self;
    
     // add this picker to our view controller, initially hidden
     self.myPickerView.hidden = YES;
     ;
    }
    
    - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
    {
     return ;
    }
    
    - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
    {
     return 2;
    }
    
    - (void)viewDidLoad
    {
     ;
    
     self.title = NSLocalizedString(@"PickerTitle", @"");
    
     // set the content size of our scroll view to match the entire screen,
     // this will allow the content to scroll in landscape
     //
     ;
    
     ;
    
     // label for picker selection output
     CGRect labelFrame = CGRectMake(kLeftMargin,
     CGRectGetMaxY(self.myPickerView.frame) + 10.0,
     CGRectGetWidth(self.view.bounds) - (kRightMargin * 2.0),
     14.0);
     self.label = initWithFrame:labelFrame];
     self.label.font = ;
     self.label.textAlignment = NSTextAlignmentCenter;
     self.label.textColor = ;
     self.label.backgroundColor = ;
     self.label.autoresizingMask = UIViewAutoresizingFlexibleWidth;
     ;
    }
    
    
    @end
     c
    




    
    
    

上一篇:绝对好停车。
下一篇:没有了
关于网站 | 网站声明 | 用户反馈 | 合作伙伴 | 联系我们
Copyright 2012年2月8日 苏ICP备12030052号-3