【代码笔记】伸缩式动漫,代码笔记伸缩

【代码笔记】iOS-UIAlertView3秒后消失,

一,效果图。

威尼斯网址开户网站 1

威尼斯网址开户网站,二,代码。

威尼斯网址开户网站 2

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

    UIAlertView* alert = [[UIAlertView alloc]initWithTitle:nil message:@"此信息3秒后消失" delegate:nil cancelButtonTitle:nil otherButtonTitles:nil, nil];
    [alert show];

    [self performSelector:@selector(dismissAlert:) withObject:alert afterDelay:3.0];
}
- (void)dismissAlert:(UIAlertView*)alert {
    if ( alert.visible ) {
        [alert dismissWithClickedButtonIndex:alert.cancelButtonIndex animated:YES];
    }
}

一,效果图。 二,代码。 – ( void )viewDidLoad { [super viewDidLoad];
// Do any additional setup after loading the view,…

一,效果图。

【代码笔记】iOS-TableViewOfTwoSecton,代码笔记

一,效果图。

威尼斯网址开户网站 3

二,工程图。

威尼斯网址开户网站 4

三,代码。

RootViewController.h

威尼斯网址开户网站 5

#import <UIKit/UIKit.h>

@interface RootViewController : UIViewController
<UITableViewDataSource,UITableViewDelegate>
{
    NSArray * dataArray;
    NSArray * aboutArray;
}

@end

威尼斯网址开户网站 6

 

RootViewController.m

威尼斯网址开户网站 7

#import "RootViewController.h"

@interface RootViewController ()

@end

@implementation RootViewController

- (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.title=@"tableViewOfTwoSection";
    //初始化背景图
    [self initBackGroundView];
    //初始化数据
    [self initData];
}
#pragma -mark -funcitons
-(void)initBackGroundView
{
    UITableView * tableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 320, 376) style:UITableViewStyleGrouped];
    tableview.delegate = self;
    tableview.dataSource = self;
    [self.view addSubview:tableview];

}
-(void)initData
{
    dataArray = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:@"脑筋急转弯", @"title", nil],[NSDictionary dictionaryWithObjectsAndKeys:@"儿童饮食", @"title",  nil], [NSDictionary dictionaryWithObjectsAndKeys:@"儿童健康", @"title",  nil],[NSDictionary dictionaryWithObjectsAndKeys:@"宝宝资讯", @"title",  nil],nil];

    aboutArray = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:@"关于", @"title", @"aboutViewController", @"class", nil], nil];
}
#pragma -mark -UITableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;

}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if(section==0)
    {
        return dataArray.count;
    }
    else if(section==1)
    {

        return aboutArray.count;
    }
    return 0;
}

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"ID"];
    if(cell==nil)
    {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"ID"];

    }
    if(indexPath.section==0){
        cell.textLabel.text =[[dataArray objectAtIndex:indexPath.row]objectForKey:@"title"];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }else if(indexPath.section==1)
    {
        cell.textLabel.text = [[aboutArray objectAtIndex:indexPath.row]objectForKey:@"title"];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(indexPath.section==0)
    {
        if(indexPath.row==0)
        {
            NSLog(@"脑筋急转弯");
        }else if (indexPath.row==1){
            NSLog(@"儿童饮食");
        }else if (indexPath.row==2){
            NSLog(@"儿童健康");
        }else if (indexPath.row==3){
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://baby.163.com"]];
        }

    }else if (indexPath.section==1) {
        if(indexPath.row==0)
        {
            NSLog(@"关于");
        }
    }
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

一,效果图。 二,工程图。 三,代码。 RootViewController.h #import
UIKit/UIKit.h @interface RootViewContro…

【代码笔记】伸缩式动画,代码笔记伸缩

一,效果图。

威尼斯网址开户网站 8

二,代码。

威尼斯网址开户网站 9

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

    [email protected]"伸缩式动画";
}
//点击任何处,弹出动画
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{

    UIView *zanView = [[UIView alloc] initWithFrame:CGRectMake(50, 100, 100, 100)];
    zanView.backgroundColor = [UIColor redColor];
    [self.view addSubview:zanView];

    [UIView animateWithDuration:0.3 animations:^{
        zanView.transform = CGAffineTransformMakeScale(1.2, 1.2);
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:0.3 animations:^{
            zanView.transform = CGAffineTransformMakeScale(0.9, 0.9);
        } completion:^(BOOL finished) {
            [UIView animateWithDuration:0.3 animations:^{
                zanView.transform = CGAffineTransformMakeScale(1.0, 1.0);
            } completion:^(BOOL finished) {

            }];
        }];
    }];

}

威尼斯网址开户网站 10

 

 

   

一,效果图。
二,代码。 – (void)viewDidLoad{ [super viewDidLoad]; // Do any
additional setup after loading the vie…

威尼斯网址开户网站 11

二,代码。

威尼斯网址开户网站 12

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

    UIAlertView* alert = [[UIAlertView alloc]initWithTitle:nil message:@"此信息3秒后消失" delegate:nil cancelButtonTitle:nil otherButtonTitles:nil, nil];
    [alert show];

    [self performSelector:@selector(dismissAlert:) withObject:alert afterDelay:3.0];
}
- (void)dismissAlert:(UIAlertView*)alert {
    if ( alert.visible ) {
        [alert dismissWithClickedButtonIndex:alert.cancelButtonIndex animated:YES];
    }
}

相关文章