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
| // 文档 https://www.dropbox.com/developers/reference/api#metadata | |
| // api中有个earlier date http://forums.dropbox.com/topic.php?id=51560 | |
| // 例子 http://www.nanaimostudio.com/blog/2011/1/20/how-to-synchronize-your-app-data-using-dropbox-api.html | |
| - (void)updateButtons { | |
| NSString* title = [[DBSession sharedSession] isLinked] ? @"Unlink Dropbox" : @"Link Dropbox"; | |
| [linkDropboxBtn setTitle:title forState:UIControlStateDisabled]; | |
| linkDropboxBtn.enabled = [[DBSession sharedSession] isLinked]; | |
| } |
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)photoFile { | |
| //此处首先指定了图片存取路径(默认写到应用程序沙盒 中) | |
| NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES); | |
| //并给文件起个文件名 | |
| NSString *uniquePath=[[paths objectAtIndex:0] stringByAppendingPathComponent:@"pin"]; | |
| BOOL blHave=[[NSFileManager defaultManager] fileExistsAtPath:uniquePath]; | |
| if (blHave) { |
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
| -------------for iOS 5--------------- | |
| - (void)viewDidLoad | |
| { | |
| [super viewDidLoad]; | |
| [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardDidChangeFrameNotification object:nil]; | |
| } | |
| //dont forget to [[NSNotificationCenter defaultCenter] removeObserver:self]; on viewDidUnload | |
| - (void)viewDidUnload | |
| { |
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)keyboardWillShow:(NSNotification *)notification | |
| { | |
| NSArray *appWindows = [[UIApplication sharedApplication] windows]; | |
| UIWindow *keyboardWindow = [appWindows lastObject]; | |
| UIView *keyboardView = [keyboardWindow.subviews objectAtIndex:0]; | |
| keyboardView = [keyboardView.subviews objectAtIndex:0]; | |
| keyboardView = [keyboardView.subviews objectAtIndex:0]; | |
| keyboardView = [keyboardView.subviews objectAtIndex:0]; | |
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
| select b.name | |
| from db_name.dbo.syscomments a,db_name.dbo.sysobjects b | |
| where a.id=b.id and b.xtype='p' and a.text like '%字符串%'; |
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
| //判断ios的版本 | |
| [[[UIDevice currentDevice] systemVersion] floatValue]; |
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
| ;; Basic Settting | |
| (push "/usr/local/bin" exec-path) | |
| (setq make-backup-files nil) | |
| (setq auto-save-default nil) | |
| (setq-default tab-width 2) | |
| (setq-default indent-tabs-mode nil) | |
| (setq inhibit-startup-message t) | |
| (fset 'yes-or-no-p 'y-or-n-p) | |
| (delete-selection-mode t) | |
| (scroll-bar-mode -1) |
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)viewDidLoad | |
| { | |
| [super viewDidLoad]; | |
| [[self view]setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_sand"]]]; | |
| } | |
| //上边的导航栏 [sparrow] | |
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
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
| //翻页效果 | |
| //经常看到iPhone的软件向上向下翻页面的效果,其实这个很简单,已经有封装好的相关方法处理。 | |
| //首先设置动画的相关参数 | |
| [UIView beginAnimati*****:@"Curl"context:nil]; | |
| [UIView setAnimationDuration:1.25]; //时间 | |
| [UIViewsetAnimationCurve:UIViewAnimationCurveEaseInOut];//速度 | |
| //然后设置动画的动作和目标视图 | |
| [UIViewsetAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES]; | |
| //参数UIViewAnimationTransitionCurlUp代表向上翻页,如果向下的话UIViewAnimationTransitionCurlDown. | |
| //forView那把当前的视图传进去。 |
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
| //Open database | |
| NSArray *documentsPaths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory | |
| , NSUserDomainMask | |
| , YES); | |
| NSString *databaseFilePath=[[documentsPaths objectAtIndex:0] stringByAppendingPathComponent:@"mydb"]; | |
| if (sqlite3_open([databaseFilePath UTF8String], &database)==SQLITE_OK) { | |
| NSLog(@"open sqlite db ok."); | |
| } |