04 2012 档案
摘要:一、静态图片的设置iOS设备现在有三种不同的分辨率:iPhone 320x480、iPhone 4 640x960、iPad 768x1024。以前程序的启动画面(图片)只要准备一个 Default.png 就可以了,但是现在变得复杂多了。下面就是 CocoaChina 会员做得总结 如果一个程序,既支持iPhone又支持iPad,那么它需要包含下面几个图片:Default-Portrait.png iPad专用竖向启动画面 768x1024或者768x1004Default-Landscape.png iPad专用横向启动画面 1024x768或者1024x748Default-Portra
        阅读全文
            
摘要:如果要移除一个 UIView 的所有子视图,SDK 里没有 remove all 之类的方法。可以用 for loop 循环调用 – removeFromSuperview 来移除 例如:for(UIView *view in [self.view subviews]){ [view removefromsuperview];}如果要移动指定的视图,可以这样: for(UIView *mylabelview in [self.view subviews]) { if ([mylabelview isKindOfClass:[UILabel class]]) { ...
        阅读全文
            
摘要:上下划动可以用类似的方法实现:#import <UIKit/UIKit.h>@interface Abstruct : UIViewController <UIScrollViewDelegate>{ UIImageView* myimageview; NSMutableArray *imgArray; CGPoint FirstPoint; CGPoint SecondPoint; NSInteger Page; BOOL touchMove;}@property (retain, nonatomic) UIImageView* myimageview;...
        阅读全文
            
摘要:MPMoviePlayerViewController用于播放视频,用法如下:NSBundle *bundle = [NSBundle mainBundle];NSString *moviePath = [bundle pathForResource:@"movie" ofType:@"mp4"];NSURL *movieURL = [NSURL fileURLWithPath:moviePath];MPMoviePlayerViewController *moviePlayerViewController = [[MPMoviePlayerViewCo
        阅读全文
            
摘要:一、始终隐藏状态栏如果在App中需要状态栏一直是隐藏着的,可以在<YOUR_APP>AppDelegate的application:didFinishLaunchingWithOptions:函数中进行设置,比如下面这段示意代码可以让状态栏以淡出的方式隐藏起来:- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after applicatio
        阅读全文
            
摘要:每隔段时间执行相应的操作://时间间隔,每隔5秒执行handleMaxShowTimer NSTimeInterval timeInterval =5.0 ; //定时器 NSTimer *showTimer = [NSTimer scheduledTimerWithTimeInterval:timeInterval target:self s...
        阅读全文
            
摘要:一、UITableView的最基本使用实现协议UITableViewDelegate,UITableViewDataSource的下述方法://设置表的分区数- (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView { return 1; }//设置每个区的行数- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section { return [UIFont familyNames].coun...
        阅读全文
            
摘要:一、UILabel的多行显示问题1.N行完全自适应: UILabel *testLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 30, 100, 21)]; NSString *txt = @"dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; testLabel.numberOfLines = 0; ///相当于不限制行数 testLabel.text = txt; 
        阅读全文
            
摘要:参考来自:http://zhiwei.li/text/2011/07/iphone%E4%B8%8Aaes%E5%8A%A0%E5%AF%86%E7%9A%84%E5%AE%9E%E7%8E%B0/头文件 NSDataEncryption.h#import <UIKit/UIKit.h>@interface NSData (AES256)- (NSData *)AES256EncryptWithKey:(NSString *)key;//加密- (NSData *)AES256DecryptWithKey:(NSString *)key;//解密@end实现 NSDataEncry
        阅读全文
            
摘要:引入头文件:#import <CommonCrypto/CommonDigest.h>加密算法://TODO: md5 加密方法- (NSString*)md5Digest:(NSString *)str{ //32位MD5小写 const char *cStr = [str UTF8String]; unsigned char result[32]; CC_MD5( cStr, strlen(cStr), result ); return [NSString stringWithFormat: ...
        阅读全文
            
摘要:首先实现UIScrollViewDelegate协议:#import <UIKit/UIKit.h>@interface Activity01ViewController : UIViewController<UIScrollViewDelegate>{ UIScrollView *myscrollview;}@property (nonatomic,retain) UIScrollView *myscrollview;@end实现协议的下列方法:#import <UIKit/UIKit.h>@interface Activity01ViewControll
        阅读全文
            
摘要:参考来自:http://www.cocoachina.com/iphonedev/sdk/2011/0525/2885.html下面是.h文件的代码//// EGORefreshTableHeaderView.h// Demo//// Created by Devin Doty on 10/14/09October14.// Copyright 2009 enormego. All rights reserved.//#import <UIKit/UIKit.h>#import <QuartzCore/QuartzCore.h>typedef enum{ EGOOPul
        阅读全文
            
摘要:参考来自:http://www.cocoachina.com/iphonedev/toolthain/2011/1019/3387.html如何用Facebook graphic api上传视频:http://developers.facebook.com/blog/post/532/Keychain保存数据封装:https://github.com/carlbrown/PDKeychainBindingsController对焦功能的实现:http://www.clingmarks.com/?p=612自定义圆角Switch按件:https://github.com/domesticcats
        阅读全文
            
摘要:参考来自:http://www.cocoachina.com/iphonedev/toolthain/2011/1109/3480.html扫描wifi信息:http://code.google.com/p/uwecaugmentedrealityproject/http://code.google.com/p/iphone-wireless/条形码扫描:http://zbar.sourceforge.net/iphone/sdkdoc/install.htmltcp/ip的通讯协议:http://code.google.com/p/cocoaasyncsocket/voip/sip:http
        阅读全文
            
摘要:MPMoviePlayerViewController是苹果提供的播放视频的控制器,可以直接从当前的控制器中推出即可。 NSBundle *bundle = [NSBundle mainBundle]; NSString *moviePath = [bundle pathForResource:@"Movie" ofType:@"m4v"]; NSURL *movieURL = [NSURL fileURLWithPath:moviePath]; MPMoviePlayerViewController *moviePlayerViewController
        阅读全文
            
摘要:一种简单的图片切换效果,如下:通过滚动中间的图片或页面控制,都可以实现图片的切换。在xib中添加UIScrollView和UIPageControl,并设置为对应类的IBOutlet,#import <UIKit/UIKit.h>@interface HomePage : UIViewController<UIScrollViewDelegate>{ IBOutlet UILabel *message; IBOutlet UIScrollView *myScrollView; IBOutlet UIPageControl *myPageControl;}@propert
        阅读全文
            
摘要:在导航栏中加上分段控件是很常用的做法,效果如下:UISegmentedControl *segmentedControl=[[UISegmentedControl alloc] initWithFrame:CGRectMake(80.0f, 8.0f, 300.0f, 30.0f) ]; [segmentedControl insertSegmentWithTitle:@"最新上架" atIndex:0 animated:YES]; [segmentedControl insertSegmentWithTitle:@"热销商品" atIndex:1 an
        阅读全文
            
摘要:1、在新建的工程中应该包含Mainwindow.xib,关于在Xcode4.2及以上中添加MainWindow.xib,可以查看这里。2、在MainWindows中添加Tab Bar Controller;3、向Tab Bar Controller中添加Navigation Controller,MainWindows的截图如下:
        阅读全文
            
摘要:参考来自:http://blog.csdn.net/muyu114/article/details/68964981、新建一个空的应用程序2、添加一个空的xib文件到这里工程的应该是下面这个样子的:3、改变File’s Owner的class为UIApplication4、从Library中添加一个Object,并设置其class为你对应的应用程序的类(这里是DemoAppDelegate)5、添加windows,并在程序中设置windows为IBOutletThe xAppDelegate.h should read something like this:@interface DemoAp
        阅读全文
            
摘要:方法一右侧进入BaseInfoEdit*View = [[BaseInfoEditalloc]initWithNibName:@"BaseInfo"bundle:nil];[self.navigationControllerpushViewController:Viewanimated:YES];返回方法[self.navigationControllerpopViewControllerAnimated:YES];方法二下方进入OilRecordAdd*View = [[OilRecordAddalloc]initWithNibName:@"OilRecordD
        阅读全文
            
 
                     
                    
                 
                    
                
 
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号