iOS學(xué)習(xí)寫的一些Demo

里面的Demo都沒(méi)有進(jìn)行封裝

一、mytaobao 模仿的淘寶中 我的淘寶界面的雙波浪圖

技術(shù)博客:地址 模仿我的淘寶雙波浪線和翻頁(yè)效果
模仿淘寶.gif

二、模仿動(dòng)動(dòng)軟件進(jìn)入菜單

CLDatePickerView.gif
CLDatePickerView.gif

三、加載動(dòng)畫 支付寶里面的加載動(dòng)畫效果

模仿淘寶.gif

四、模仿淘寶選擇購(gòu)物車 模仿淘寶選擇顏色、尺碼界面 并加入購(gòu)物車拋物線動(dòng)畫

模仿淘寶.gif

五、圖片輪播 三張imageView 相互切換實(shí)現(xiàn)的

輪播圖.gif

使用方法

- (void)viewDidLoad {
    [super viewDidLoad];
  
    CGRect frame = CGRectMake(0, 100, self.view.frame.size.width, 200);
    
    NSArray *imageArr = @[@"1.jpg",@"2.png",@"3.jpg",@"4.jpg",@"1.jpg",@"2.png",@"3.jpg",@"4.jpg",@"1.jpg",@"2.png",@"3.jpg",@"4.jpg"];
    
    CLCycleView *cycleView = [[CLCycleView alloc] initWithFrame:frame duration:3 imageArr:imageArr];
    cycleView.delegate = self;
    cycleView.currentPageIndicatorTintColor = [UIColor redColor];
    cycleView.pageIndicatorTintColor = [UIColor blueColor];
    cycleView.diameter = 20;
    cycleView.cycleView = ^(NSInteger indexPage) {
        NSLog(@"block顯示點(diǎn)擊%ld張圖片",indexPage);
    };
    
    self.cycleView = cycleView;
    [self.view addSubview:cycleView];
  
}


#pragma mark - cycleViewDelegate
- (void)cycleViewDidSelected:(NSInteger)pageIndex {
    
     NSLog(@"delegate顯示點(diǎn)擊%ld張圖片",pageIndex);
    [self.cycleView stop];
    
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"CLCycleView" message:[NSString stringWithFormat:@"點(diǎn)擊了第%ld張圖片,并且停止播放",pageIndex] preferredStyle:UIAlertControllerStyleAlert];
    
    [alert addAction:[UIAlertAction actionWithTitle:@"開(kāi)始輪播" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
        [self.cycleView start];
        
        
    }]];
    
    
    [self presentViewController:alert animated:YES completion:nil];
}

六、AlertController 模仿微信的彈出框

AlertController.gif

調(diào)用方法和UIAlertController一樣

    CLAlertController *alert = [CLAlertController alertControllerWithTitle:@"更改頭像" message:@"選擇方式如下:各種小魔頭這是一個(gè)AlertController 用來(lái)學(xué)習(xí)用的這是一個(gè)AlertController 用來(lái)學(xué)習(xí)用的這是一個(gè)AlertController 用來(lái)學(xué)習(xí)用的" preferredStyle:CLAlertControllerStyleSheet];

    [alert addAction:[CLAlertModel actionWithTitle:@"打開(kāi)相機(jī)" style:CLAlertActionStyleDefault handler:^(CLAlertModel *action) {
        
    }]];
    
    [alert addAction:[CLAlertModel actionWithTitle:@"保存照片" style:CLAlertActionStyleDefault handler:^(CLAlertModel *action) {
        
    }]];
    
    [alert addAction:[CLAlertModel actionWithTitle:@"打開(kāi)相冊(cè)" style:CLAlertActionStyleDestructive handler:^(CLAlertModel *action) {
        
    }]];
    
    [alert addAction:[CLAlertModel actionWithTitle:@"取消" style:CLAlertActionStyleCancel handler:^(CLAlertModel *action) {
        
    }]];
    
    
    
    [self presentToViewController:alert completion:nil];

七、CLDataPickerController 這個(gè)是年月選擇器 內(nèi)部用UIPickView實(shí)現(xiàn)的

CLDatePickerView.gif

使用方法

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    
    CLDatePickerView *datePicker = [[CLDatePickerView alloc] init];
    datePicker.delegate = self;
    [self.view addSubview:datePicker];
    
}

// 這個(gè)是代理方法
- (void)datePickerView:(CLDatePickerView *)datePickerView didSelectedItem:(NSString *)year month:(NSString *)month {
    
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"CLDatePickerView" message:[NSString stringWithFormat:@"選擇了:%@年%@月",year,month] delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:nil];
    [alertView show];
    
}

八、CLKeyboardPassWord 這個(gè)是密碼鍵盤 下面的數(shù)字是隨機(jī)生成的 對(duì)支付時(shí)輸入密碼更安全 調(diào)用只需要

CLKeyboardPassWord.gif

使用方法

    key = [[CLKeyBoardPassWord alloc] initWithPassword:^(NSString *password) {
        
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"密碼" message:password delegate:self cancelButtonTitle:nil otherButtonTitles:@"確定", nil];
        
        [alert show];
        
    } backBlock:^(UIView *view) {
        
      [key dismiss];
        
    }];
    [key show];

九、CLPhotoWall 這個(gè)是仿照微信的多選圖片

CLPhotoWall.gif

使用方法

可以用Cocoapods導(dǎo)入  pod "CLPhotoWall"

/*****************************************************************************/
/***************************下面是完成多選照片的方法*******************************/
/*****************************************************************************/

    // 多張選擇圖片需要調(diào)用的方法如下
    // 1、通過(guò)通知來(lái)獲取圖片
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(choosePhoto:) name:CLPhotoAssetSelectImageNotificationName object:nil];
    
}

//2、 實(shí)現(xiàn)通知方法  獲取圖片
- (void)choosePhoto:(NSNotification *)noti {
    
    
    // 內(nèi)部存放的是CLPhotoAssetInfo的對(duì)象
    
    /*
     @property (nonatomic, strong) PHAsset *asset;
     @property (nonatomic, strong) UIImage *nomalImage;
     @property (nonatomic, strong) UIImage *largeImage;
     */
    
    NSArray *images = noti.userInfo[CLPhotoAssetSelectImageNotificationUserInfoKey];
    
    
    [self.dataSource addObjectsFromArray:images];
    
    [self.collectionView reloadData];
    
    NSLog(@"%@",images);
    
    
}

//3、 跳轉(zhuǎn)到圖片選擇界面
- (void)selectImage {
    
    CLPhotoAlbumViewController *albumVC = [[CLPhotoAlbumViewController alloc] init];
    albumVC.maxCount = 3;
    albumVC.didSelectCount = self.dataSource.count;
    [self.navigationController presentViewController:[[UINavigationController alloc] initWithRootViewController:albumVC] animated:YES completion:nil];
    
}

/*****************************************************************************/
/****************************上面是完成多選照片的方法******************************/
/*****************************************************************************/

最后附Demo地址
歡迎各位伙伴們的Star

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • http://mp.weixin.qq.com/s/Czm-LoW0Deh9gIqgel6psw
    時(shí)光小屋閱讀 149評(píng)論 0 0
  • 就像什么呢,就像你朝著空谷大喊"喂,有人嗎?",等待良久那邊什么回響也沒(méi)有,只留下你一個(gè)人的落寞與驚駭。哦,...
    走馬1228閱讀 318評(píng)論 0 1
  • 第三天每日文,不似前兩天有主題,靈感如泉涌,指尖飛舞,機(jī)械鍵盤敲擊的聲樂(lè)此起彼伏,激起大腦皮層久違的活躍和興奮。 ...
    三飯姨閱讀 808評(píng)論 0 1

友情鏈接更多精彩內(nèi)容