网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

弹性变化放大图片-创新互联

//
//  ProfileViewController.m
//  TwProfile
//
//  Created by hunk on 4/30/13.
//  Copyright (c) 2013 mx.com.hunk. All rights reserved.
//
#import "ProfileViewController.h"
static CGFloat ImageHeight  = 150.0;
static CGFloat ImageWidth  = 320.0;
@interface ProfileViewController ()
@end
@implementation ProfileViewController
- (void)updateImg {
    CGFloat yOffset   = _tableView.contentOffset.y;
      
    if (yOffset < 0) {
          
        CGFloat factor = ((ABS(yOffset)+ImageHeight)*ImageWidth)/ImageHeight;
        CGRect f = CGRectMake(-(factor-ImageWidth)/2, 0, factor, ImageHeight+ABS(yOffset));
        self.imgProfile.frame = f;
    } else {
        CGRect f = self.imgProfile.frame;
        f.origin.y = -yOffset;
        self.imgProfile.frame = f;
    }
}
#pragma mark - Table View Delegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    [self updateImg];
}
#pragma mark - Table View Datasource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if (section == 0)
        return 1;
    else
        return 12;
      
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0)
        return ImageHeight;
    else
        return 44.0;
      
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *cellReuseIdentifier   = @"SectionTwoCell";
    NSString *windowReuseIdentifier = @"SectionOneCell";
      
    UITableViewCell *cell = nil;
      
    if (indexPath.section == 0) {
        cell = [tableView dequeueReusableCellWithIdentifier:windowReuseIdentifier];
        if (!cell) {
              
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:windowReuseIdentifier];
        }
    } else {
        cell = [tableView dequeueReusableCellWithIdentifier:cellReuseIdentifier];
        if (!cell) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellReuseIdentifier];
            cell.contentView.backgroundColor = [UIColor lightGrayColor];
              
              
        }
        cell.textLabel.text = [ NSString stringWithFormat:@"cell %i",indexPath.row];
    }
      
    cell.selectionStyle              = UITableViewCellSelectionStyleNone;
      
    return cell;
}
- (id)init
{
    self = [super init];
    if (self) {
        // Custom initialization
          
        UIImage *p_w_picpath = [UIImage p_w_picpathNamed:@"bg.png"];
        self.imgProfile = [[UIImageView alloc] initWithImage:p_w_picpath];       
        self.imgProfile.frame             = CGRectMake(0, 0, ImageWidth, ImageHeight);
          
        self.tableView = [[UITableView alloc] init];
        self.tableView.dataSource = self;
        self.tableView.delegate = self;
        self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        self.tableView.backgroundColor = [UIColor clearColor];
        [self.view addSubview:self.imgProfile];
        [self.view addSubview:self.tableView];
          
        self.title = @"with UITableView";
    }
    return self;
}
#pragma mark - View lifecycle
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
      
    CGRect bounds = self.view.bounds;
    _tableView.frame = bounds;
}
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end

创新互联主要从事成都网站设计、网站建设、网页设计、企业做网站、公司建网站等业务。立足成都服务若羌,10余年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18980820575

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


分享名称:弹性变化放大图片-创新互联
分享网址:http://bjjierui.cn/article/jhcpi.html

其他资讯