您的位置:首页 > 其它

源码推荐(6.17):keyboard细节处理 流畅 简洁 复用性高,用tableview解决长文字 过多项的Actio

2015-06-17 09:02 771 查看
keyboard细节处理,流畅,简洁,复用性高(作者:ycctime)
第一次发代码 ,有不妥之处,请大神指教。代码包含键盘处理(解决输入多行文字高度不稳定bug)和coreData封装支持多线程,通过self.keyBoard = [[LYKeyBoardView alloc]initDelegate:self superView:self.view];一句代码你就可以拥有一个完整的键盘。本代码封装希望下载者可以直接拿到你的工程中取用,不需要修改太多内容。
测试环境:Xcode 6.2,iOS 6.0以上


用tableview解决长文字,过多项的ActionSheet(作者:frank_xiong)
- (id) initWithTitle:(NSString *)title delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... {
    if (self = [super initWithFrame:[UIScreen mainScreen].bounds]) {
        _title = title;
        _delegate = delegate;
        _cancelButtonTitle = cancelButtonTitle;
        _otherButtonArray = [NSMutableArray array];
        va_list args;
        va_start(args, otherButtonTitles);
        if (otherButtonTitles) {
            [_otherButtonArray addObject:otherButtonTitles];
            while (1) {
                NSString *otherButtonTitle = va_arg(args, NSString *);
                if (otherButtonTitle == nil) {
                    break;
                } else {
                    [_otherButtonArray addObject:otherButtonTitle];
                }
            }
        }
        va_end(args);
        
        self.backgroundColor = [UIColor clearColor];
        
        UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
        _backgroundView = [[UIView alloc] initWithFrame:self.frame];
        _backgroundView.alpha = 0;
        _backgroundView.backgroundColor = [UIColor blackColor];
        [_backgroundView addGestureRecognizer:tapGestureRecognizer];
        [self addSubview:_backgroundView];
        
        [self initContentView];
    }
    return self;
}
测试环境:Xcode 6.2,iOS 6.0以上


瀑布流demo(完美注释)(作者:707088481)
collectView瀑布流
测试环境:Xcode 6.2,iOS 6.0以上


仿网易首页翻页导航效果(作者:威小威)
YKPageView
仿网易首页翻页导航效果,菜单栏标题的字体和颜色都是可动画的,颜色要动画的话,颜色必须是有RGB分量的(比如由RGBA创建)
使用方法很简单,实现刻意模仿了UITableView的代理,因而使用方式相似,实现相应代理即可:
DataSource
//  用来获取PageCell
- (WKPageCell *)pageView:(WKPageView *)pageView cellForIndex:(NSInteger)index;
//  用来设置menu上的标题,以NSString的形式,用NSArray封装
//  其count即为PageView的page的页数
- (NSArray *)menuItemsForMenuViewInPageView:(WKPageView *)pageView;
Delegate
/**
 *  设置menuView的高度,默认为30
 *
 *  @param pageView 当前翻页视图
 *  @param menuView 顶部菜单视图
 *
 *  @return menuView的高度
 */
- (CGFloat)pageView:(WKPageView *)pageView heightForMenuView:(WKMenuView *)menuView;
/**
 *  设置menuView的背景颜色,默认:[UIColor colorWithRed:172.0/255.0 green:165.0/255.0 blue:162.0/255.0 alpha:1.0]
 *  @param pageView 当前翻页视图
 *
 *  @return UIColor
 */
- (UIColor *)backgroundColorOfMenuViewInPageView:(WKPageView *)pageView;
/**
 *  设置菜单栏标题颜色(若要动画必须创建自RGBA,或者某些有RGB分量的UIColor如:redColor,而例如grayColor不行)
 *
 *  @param pageView 当前翻页视图
 *  @param state    分为WKMenuItemTitleColorStateNormal(未选中)/WKMenuItemTitleColorStateSelected(选中)
 *
 *  @return UIColor(RBGA)
 */
- (UIColor *)titleColorOfMenuItemInPageView:(WKPageView *)pageView withState:(WKMenuItemTitleColorState)state;
/**
 *  设置菜单栏标题字体大小(大于零)
 *
 *  @param pageView 当前翻页视图
 *  @param state    分为WKMenuItemTitleSizeStateNormal(未选中)/WKMenuItemTitleSizeStateSelected(选中)
 *
 *  @return 标题字体大小
 */
- (CGFloat)titleSizeOfMenuItemInPageView:(WKPageView *)pageView withState:(WKMenuItemTitleSizeState)state;
/**
 *  设置菜单栏内部item的宽度,默认宽度为60
 *
 *  @param pageView 当前翻页视图
 *  @param index    WKMenuItem的序号,可根据序号定制
 *
 *  @return item的宽度
 */
- (CGFloat)pageView:(WKPageView *)pageView widthForMenuItemAtIndex:(NSInteger)index;
测试环境:Xcode 6.2,iOS 6.0以上


swift开发的FlappyBird(作者:3334066)
学习swift语言,拿来以前写着玩的小游戏练练手
测试环境:Xcode 6.2,iOS 8.0以上

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: