This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Douban OAuth认证包括以下四步内容 | |
# 1. 获取Request Token | |
# 2. 用户确认授权 | |
# 3. 换取Access Token | |
# 4. 访问受限资源 | |
require "rubygems" | |
gem 'oauth','0.4.3' | |
require 'oauth' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) fadeOut: (id) sender | |
{ | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
[UIView beginAnimations:nil context:context]; | |
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; | |
[UIView setAnimationDuration:1.0]; | |
[[self.view viewWithTag:999] setAlpha:0.0f]; | |
[UIView commitAnimations]; | |
self.navigationItem.rightBarButtonItem = BARBUTTON(@"Fade In", @selector(fadeIn:)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView | |
{ | |
CGFloat pageWidth = galleryScrollView.frame.size.width; | |
int currentPage = floor((galleryScrollView.contentOffset.x - pageWidth / 2) / 320) + 1; | |
[self loadSelectedPage:currentPage]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
#import <Foundation/Foundation.h> | |
/*@protocol MActivityIndicatorProtocol | |
- (void)handleTask:(SEL)task; | |
- (void)hideIndicator; | |
@end*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)applicationWillResignActive:(UIApplication *)application { | |
/* | |
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | |
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. | |
*/ | |
NSLog(@"applicationWillResignActive"); | |
UIApplication *app = [UIApplication sharedApplication]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSDictionary *magazineDict = [NSDictionary dictionary]; | |
[[NSUserDefaults standardUserDefaults] registerDefaults:magazineDict]; | |
// write data to /Library/Preferences. | |
[[NSUserDefaults standardUserDefaults] synchronize]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MUtility.m | |
// Magazine | |
// | |
// Created by wang xuefeng on 10-12-9. | |
// Copyright 2010 www.5yi.com. All rights reserved. | |
// | |
#import "MUtility.h" | |
#import "MFoundation.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MPageView.h | |
// Magazine | |
// | |
// Created by wang xuefeng on 10-12-9. | |
// Copyright 2010 www.5yi.com. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MScrollView.h | |
// Magazine | |
// | |
// Created by wang xuefeng on 10-12-16. | |
// Copyright 2010 www.5yi.com. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
#import "MPageView.h" |