您现在的位置: IOS教程網 >> IOS系統 >  >> iOS 程式開發 >> iOS 開發基礎

精選開源推薦(6.24):MP3 播放控制器與高仿支付寶手勢解鎖

編輯:iOS 開發基礎

MP3 播放控制器(作者:jxb_sir)

支持自定義配色,可播放本地與網絡 MP3,網絡音頻會展示下載進度。

測試環境:Xcode 6.2,iOS 6.0 以上

PCGestureUnlock —— 高仿支付寶手勢解鎖(作者:iosdeveloperpanc)

目前最全面、最接近支付寶體驗的手勢解鎖實現,並開放參數修改能力,基本能覆蓋項目中所有手勢解鎖需求。

框架基礎:完整還原支付寶手勢解鎖的各種細節(見下方 gif)。

框架目標:做成主流手勢解鎖的終結者,簡單易用、高度解耦。

框架特點:面向實際項目開發,只需調整 PCCircleViewConst.h 中的參數即可滿足具體需求。

能力清單:

設置密碼;全方向箭頭;錯誤繪製;跳躍連線等細節處理。

使用說明:解鎖界面 PCCircleView 可以實例化出不同形態,實現以下初始化方法即可。

// 初始化方法(設置 view 的相關類型、參數)
// clip 代表圓內是否剪切,arrow 代表是否有三角箭頭
- (instancetype)initWithType:(CircleViewType)type clip:(BOOL)clip arrow:(BOOL)arrow;

測試環境:Xcode 6.2,iOS 6.0 以上

UITableView 實現橫向滑動(作者:lxf2015)

核心思路很取巧:把 tableView 整體旋轉 -90 度,再把每個 cell 的 contentView 反向旋轉 90 度抵消回來,於是縱向列表就变成了橫向滑動。

- (void)viewDidLoad {
    [super viewDidLoad];

    UILabel *headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height / 2 - 225, CGRectGetWidth(self.view.frame), 25)];
    [headerLabel setBackgroundColor:[UIColor blueColor]];
    [headerLabel setAlpha:0.5];
    [headerLabel setTextColor:[UIColor colorWithRed:172.0/255.0 green:74.0/255.0 blue:93.0/255.0 alpha:1.0]];
    [headerLabel setText:@"莊周夢蝶"];
    [headerLabel setFont:[UIFont systemFontOfSize:18]];
    [self.view addSubview:headerLabel];

    UITableView *myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height/2 - 100, 100, self.view.frame.size.height - 100)];
    [myTableView.layer setAnchorPoint:CGPointMake(0.0, 0.0)];
    myTableView.transform = CGAffineTransformMakeRotation(-M_PI_2);
    myTableView.dataSource = self;
    myTableView.delegate = self;
    myTableView.scrollEnabled = YES;
    myTableView.userInteractionEnabled = YES;
    myTableView.showsVerticalScrollIndicator = NO;
    myTableView.frame = CGRectMake(0, self.view.frame.size.height/2 - 100, self.view.frame.size.width, 100);
    myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [myTableView setBackgroundColor:[UIColor whiteColor]];
    [self.view addSubview:myTableView];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 15;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *identifier = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
        cell.selectionStyle = UITableViewCellSelectionStyleBlue;
        self.myLogo = [[LogoView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame), 100)];
        self.myLogo.tag = 101;
        [cell.contentView addSubview:self.myLogo];
    }
    cell.contentView.transform = CGAffineTransformMakeRotation(M_PI_2);
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 100;
}

測試環境:Xcode 6.2,iOS 6.0 以上

MVC 代碼復用 + 下拉刷新 + 字典模型(作者:rdx)

把 MVC 各層的代碼復用、下拉刷新與字典轉模型這幾件事一起示範清楚。

測試環境:Xcode 6.2,iOS 6.0 以上

Pulling Refresh —— 簡單靈活的下拉刷新(作者:twinst)

接口設計清爽,表頭表尾刷新、開關控制、回調註冊應有盡有:

// 設置 refresh header indicator
- (void)setRefreshHeaderIndicator:(id)indicator;
// 通過 indicator 類設置 header
- (void)setRefreshHeaderWithIndicatorClass:(Class)clazz;
// 設置 refresh footer indicator
- (void)setRefreshFooterIndicator:(id)indicator;
// 通過 indicator 類設置 footer
- (void)setRefreshFooterWithIndicatorClass:(Class)clazz;
// 停止 header 刷新
- (void)stopHeaderRefreshing;
// 停止 footer 刷新
- (void)stopFooterRefreshing;
// 手動觸發 header 刷新
- (void)refreshHeader;
// 手動觸發 footer 刷新
- (void)refreshFooter;
// 整體開關,需要動態切換可刷新狀態時使用
- (void)setRefreshEnabled:(BOOL)refreshEnabled;
- (void)setRefreshHeaderEnabled:(BOOL)refreshEnabled;
- (void)setRefreshFooterEnabled:(BOOL)refreshEnabled;
// header 刷新回調
- (void)setRefreshHeaderCallback:(void (^)())refreshHeaderCallback;
// footer 刷新回調
- (void)setRefreshFooterCallback:(void (^)())refreshFooterCallback;

測試環境:Xcode 6.2,iOS 6.0 以上

  1. 上一篇文章:
  2. 下一篇文章:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © IOS教程網 All Rights Reserved