茄子在线看片免费人成视频,午夜福利精品a在线观看,国产高清自产拍在线观看,久久综合久久狠狠综合

    <s id="ddbnn"></s>
  • <sub id="ddbnn"><ol id="ddbnn"></ol></sub>

  • <legend id="ddbnn"></legend><s id="ddbnn"></s>

    用Animation實(shí)現(xiàn)iphone動(dòng)畫效果
    來源:易賢網(wǎng) 閱讀:1610 次 日期:2014-11-04 11:09:15
    溫馨提示:易賢網(wǎng)小編為您整理了“用Animation實(shí)現(xiàn)iphone動(dòng)畫效果”,方便廣大網(wǎng)友查閱!

    1、寫了一個(gè)小Demo,實(shí)現(xiàn)上下移動(dòng)的效果圖:

    名單1

    名單2

    名單3

    主要代碼如下:

    - (IBAction)upChange:(id)sender {

    if (typeView == down) {

    [self.downBtn setHidden:NO];

    [self.upBtn setHidden:NO];

    [UIView animateWithDuration:0.5 animations:^{

    self.upView.center = CGPointMake(self.upView.center.x, 0);

    self.downView.center = CGPointMake(self.downView.center.x, (self.upView.frame.size.height+self.downView.frame.size.height)/2);

    }];

    typeView = middle;

    }else if(typeView == middle){

    [self.downBtn setHidden:NO];

    [self.upBtn setHidden:YES];

    [UIView animateWithDuration:0.5 animations:^{

    self.upView.center = CGPointMake(self.upView.center.x, -(self.upView.frame.size.height/2));

    self.downView.center = CGPointMake(self.downView.center.x, self.downView.frame.size.height/2);

    }];

    typeView = up;

    }

    }

    - (IBAction)downChange:(id)sender {

    if (typeView == middle) {

    [self.downBtn setHidden:YES];

    [self.upBtn setHidden:NO];

    [UIView animateWithDuration:0.5 animations:^{

    self.upView.center = CGPointMake(self.upView.center.x, self.upView.frame.size.height/2);

    self.downView.center = CGPointMake(self.downView.center.x, self.upView.frame.size.height+self.downView.frame.size.height/2);

    }];

    typeView = down;

    }else if(typeView == up)

    {

    [self.downBtn setHidden:NO];

    [self.upBtn setHidden:NO];

    [UIView animateWithDuration:0.5 animations:^{

    self.upView.center = CGPointMake(self.upView.center.x, 0);

    self.downView.center = CGPointMake(self.downView.center.x, (self.upView.frame.size.height+self.downView.frame.size.height)/2);

    }];

    typeView = middle;

    }

    }

    這是主要的代碼,另外還有一些需要注意的一些小細(xì),如你的兩個(gè)view的大小,需要計(jì)算出精確位置。

    下面開始學(xué)習(xí)[UIView animateWithDuration]方法的使用:

    函數(shù)原型:

    + (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0); // delay = 0.0, options = 0, completion = NULL

    duration:動(dòng)畫持續(xù)時(shí)間

    animations:該代碼兒塊中是所有view要完成的動(dòng)畫的所有屬性的定義;

    還有另外兩個(gè)函數(shù):

    + (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);

    + (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion__OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);// delay = 0.0, options = 0

    options:是動(dòng)畫執(zhí)行的選項(xiàng)

    completion:是動(dòng)畫完成以后所要執(zhí)行的代碼塊兒。

    更多信息請(qǐng)查看IT技術(shù)專欄

    更多信息請(qǐng)查看技術(shù)文章
    易賢網(wǎng)手機(jī)網(wǎng)站地址:用Animation實(shí)現(xiàn)iphone動(dòng)畫效果
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2026國(guó)考·省考課程試聽報(bào)名

    • 報(bào)班類型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專用圖標(biāo)