Skip to content

Instantly share code, notes, and snippets.

/* 过渡效果
fade //交叉淡化过渡(不支持过渡方向)
push //新视图把旧视图推出去
moveIn //新视图移到旧视图上面,
reveal //将旧视图移开,显示下面的新视图
cube //立方体翻滚效果
oglFlip //上下左右翻转效果
suckEffect //收缩效果,如一块布被抽走(不支持过渡方向)
rippleEffect //滴水效果(不支持过渡方向)
pageCurl //向上翻页效果
-(void)viewDidLoad{
[super viewDidLoad];
UIButton *btnFlip = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btnFlip.frame = CGRectMake(10, 10, 50, 30);
[btnFlip setTitle:@"flip" forState:UIControlStateNormal];
[btnFlip addTarget:self action:@selector(flip) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btnFlip];
panel = [[UIView alloc] initWithFrame:CGRectMake(10, 40, 300,300)];
panel.backgroundColor = [UIColor darkGrayColor];
#define NavigationBar_HEIGHT 44
#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
#define SAFE_RELEASE(x) [x release];x=nil
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
#define CurrentSystemVersion ([[UIDevice currentDevice] systemVersion])
#define CurrentLanguage ([[NSLocale preferredLanguages] objectAtIndex:0])
#define BACKGROUND_COLOR [UIColor colorWithRed:242.0/255.0 green:236.0/255.0 blue:231.0/255.0 alpha:1.0]
//use dlog to print while in debug model
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
UIImage* image = [UIImage imageNamed:@"avatar.png"];
CGPathRef visiblePath = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:10].CGPath;
CGContextAddPath(context, visiblePath);
CGContextClip(context);
[image drawInRect:rect];
CABasicAnimation* theAnimaiton;
theAnimaiton = [CABasicAnimationanimationWithKeyPath:@"transform.translation.x"];
theAnimaiton.fromValue = [NSNumber numberWithInt:-30];
theAnimaiton.toValue = [NSNumber numberWithInt:200];
theAnimaiton.timingFunction = [CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseIn];
theAnimaiton.duration = 0.6;
theAnimaiton.delegate = self;
theAnimaiton.fillMode = kCAFillModeForwards;
theAnimaiton.removedOnCompletion = NO; // 设置为NO,保证动画不被移除,保证animation上FillMode的值有效
theAnimaiton.autoreverses = YES;
///////////////////////////////////////////////////////////////////////////////////////////////////
- (IBAction)showModeButtonPressed:(id)sender {
NewsCenterViewController* newViewcontroller = [[NewsCenterViewController alloc] initWithNibName:@"NewsCenterViewController" bundle:nil];
newViewcontroller.delegate = self;
UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:newViewcontroller];
[self pushNavigationController:nav];
}
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
// 拼车族导航
CarSharingViewController* carSharingViewController = [[CarSharingViewController alloc] init];
UINavigationController* mainNav = [[UINavigationController alloc] initWithRootViewController:carSharingViewController];
UIImage *image = [UIImage imageNamed:@"CarSharingNavBG.png"];
[mainNav.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
// 立即用车导航
APP = MyProject
WORKSPACE = MyProject
CONFIG = Release
SCHEME = MyProject
# iMessage addresses list seperated with white space
IMSG_LIST = xdreamarshal@gmail.com
# Comment the following line if you prefer Bonjour Network
# BASE_URL = http://ota.nsnotfound.com
UIImage *grayImage(UIImage *source)
{
int width = source.size.width;
int height = source.size.height;
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
CGContextRef context = CGBitmapContextCreate (nil,
width,
height,
platform :ios, '6.0'
pod 'AFNetworking', '1.2.0'
pod 'FPPopover', :git => 'https://github.com/50pixels/FPPopover.git'