Skip to content

Instantly share code, notes, and snippets.

@tony0x59
tony0x59 / UITableView+reloadDataAnimated.m
Created August 31, 2013 06:31
tableview重载数据时的淡入淡出动画过渡效果
#import "UITableView+reloadDataAnimated.h"
@implementation UITableView (reloadDataAnimated)
- (void)reloadDataWithAnimated:(BOOL)animated
{
[self reloadData];
if (animated) {
CATransition *animation = [CATransition animation];
@tony0x59
tony0x59 / NSObject+SafeCategory.m
Last active July 19, 2017 23:15
使用Method swizzling方法修改常用函数行为
//
// NSObject+SafeCategory.m
//
// Created by Tony on 14-4-3.
// Copyright (c) 2014年 Tony. All rights reserved.
//
#import "NSObject+SafeCategory.h"
#import <JRSwizzle/JRSwizzle.h>
@tony0x59
tony0x59 / makeWNDR3800_BB_rc2
Last active January 18, 2017 09:28
my wndr3800 openwrt custom make config
#!/bin/bash
mpfl="WNDR3700"
mpkg=""
# luci
mpkg+="luci luci-ssl luci-i18n-chinese"
# dnsmasq-full for FreeRouterV2
mpkg+=" -dnsmasq dnsmasq-full"
void bin_to_strhex(unsigned char *bin, uint32_t size)
{
char hex_str[]= "0123456789ABCDEF";
unsigned int i;
char *result;
result = (char *)malloc(size * 2 + 1);
(result)[size * 2] = 0;
if (!size)
- (BOOL)checkNotificationIsEnabled {
UIApplication *application = [UIApplication sharedApplication];
BOOL enabled = NO;
// iOS8 and above
if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) {
if ([application isRegisteredForRemoteNotifications]) {
UIUserNotificationSettings *settings = [[UIApplication sharedApplication] currentUserNotificationSettings];
if (settings.types != UIUserNotificationTypeNone) {
enabled = YES;
}
@tony0x59
tony0x59 / setUIViewAlpha.m
Last active December 21, 2015 22:19
设置本UIView透明,但子视图不受影响(不透明)
self.backgroundColor = [[UIColor darkGrayColor] colorWithAlphaComponent:0.85];
@tony0x59
tony0x59 / moveInAnimateUIView.m
Last active December 21, 2015 22:19
从顶部弹出视图的动画效果,当退出视图时调用[self leaveView]将视图弹出。
#pragma mark - UIAnimation
- (void)willMoveToSuperview:(UIView *)newSuperview
{
[self enterView];
}
#define ANIMATE_DURATION 0.3
- (void)enterView
{
@tony0x59
tony0x59 / UIColor+CreateMethod.h
Last active December 19, 2015 01:19
UIColor便捷设置
#define UIColorFromHexRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define UIColorFrom8BitRGB(r, g, b) [UIColor \
colorWithRed:(r)/255.0 \
green:(g)/255.0 \
blue:(b)/255.0 alpha:1.0]
@tony0x59
tony0x59 / GradientView.m
Last active December 17, 2015 18:19
iOS UIView 渐变色绘制
//
// GradientView.m
// GradientDemo
//
// Created by Tony Kong on 13-5-26.
// Copyright (c) 2013年 Tony Kong. All rights reserved.
//
#import "GradientView.h"
@tony0x59
tony0x59 / uncrustify.cfg
Created July 3, 2015 10:33
uncrustify.cfg
#
# Uncrustify Configuration File
# File Created With UncrustifyX 0.2 (140)
#
# Alignment
# ---------
## Alignment