随笔分类 - IOS
IOS,Iphone,Xcode4.3+
摘要:@interface ViewController : UIViewController<UIScrollViewDelegate>{ UIScrollView *myScrollView; UIPageControl *myPageControl;}@property(nonatomic,strong) UIScrollView *myScrollView;@property(nonatomic,strong) UIPageControl *myPageControl;@implementation ViewController@synthesize myScrollView;@
阅读全文
摘要:按钮点击调用//拍照按钮 UIButton *button5 = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button5.frame = CGRectMake(50, 10, 220, 40); [button5 setTitle:@"拍照" forState:UIControlStateNormal]; [button5 addTarget:self action:@selector(pickPhotoFromCamera:) forControlEvents:UIControlEventTouchUpIn..
阅读全文
摘要:以创建MyObject类对应的myobject表为例#import <Foundation/Foundation.h>#import <sqlite3.h>#import "MyObject.h"@interface DBCommon : NSObject{ id theDelegate; //声明数据库 sqlite3 *database; //是否第一次创建该数据库 BOOL firstCreate;}//打开数据库-(BOOL)open;//创建数据表MyObject-(BOOL)createTableMyObject:(sqlite3 *)d
阅读全文
摘要:从Documents目录下读取图片列表时,有加载延迟,界面有一个空白期。我想办法默认显示空图片占位(显示一个默认灰边图片),然后使用NSThread加载真正的图片UIImageView 添加在UIScrollView中 _myScrollView,3步走:for(int i=0;i<10;i++){ UIImageView *iv = [[UIImageViewalloc] initWithFrame:CGRectMake(0,i*110,320,300)]; iv.image = [UIImageimageNamed:@"defautlImage"]; [_mySc
阅读全文
摘要:UIScrollView初始化://滚动视图 _myScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 44)]; _myScrollView.pagingEnabled = NO; //是否翻页 _myScrollView.showsVerticalScrollIndicator = NO;//不显示垂直方向的滚动条 _myScrollView.bounces = YES;/...
阅读全文
摘要:#import <UIKit/UIKit.h>@interface AppDelegate : UIResponder <UIApplicationDelegate>@property (strong, nonatomic) UIWindow *window;@property (strong, nonatomic) UINavigationController *navigationController;@end@implementation AppDelegate@synthesize navigationController = _navigationContro
阅读全文
摘要:-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *CellIdentifier = @"Item1_Cell"; CustomTabBarItem1Cell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell == nil){ cell = [[CustomTabBarIt...
阅读全文
摘要:官方网站:http://allseeing-i.com/ASIHTTPRequest/。可以从上面下载到最新源码,以及获取到相关的资料。使用iOS SDK中的HTTP网络请求API,相当的复杂,调用很繁琐,ASIHTTPRequest就是一个对CFNetwork API进行了封装,并且使用起来非常简单的一套API,用Objective-C编写,可以很好的应用在Mac OS X系统和iOS平台的应用程序中。ASIHTTPRequest适用于基本的HTTP请求,和基于REST的服务之间的交互。ASIHTTPRequest功能很强大,主要特色如下:l 通过简单的接口,即可完成向服务端提交数据和从服务
阅读全文
摘要:官方下载地址:http://code.google.com/p/ziparchive/ZipArchive *unzip = [[ZipArchivealloc] init]; if ([unzip UnzipOpenFile:fileName]) { //解压 BOOL result = [unzip UnzipFileTo:filepath overWrite:YES]; if (result) { NSLog(@"解压成功!"); } [unzip UnzipCloseFile]; }[unzip release];-(BOOL) Create...
阅读全文
摘要:-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [[event allTouches] anyObject]; CGPoint touchPoint = [touch locationInView:self.view];......}
阅读全文
摘要:@interface GlobalSingleton : NSObject{}+(GlobalSingleton*)sharedGlobalSingleton;@implementation GlobalSingleton-(id)init{ self = [super init]; if(self){ //全局属性初始化 } return self;}+(GlobalSingleton*)sharedGlobalSingleton{ static GlobalSingleton *sharedGlobalSingleton; @synchro...
阅读全文
摘要:ARC项目中使用了一些外部实用类,这些类没有使用ARC,必须做一下调整项目才能编译 。Targets属性 》》Build Phases标签 》》 Compile Sources设置不使用ARC的类的 Compile Flags 为 “-fno-objc-arc” 。
阅读全文
摘要:1 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 2 { 3 //隐藏状态栏 4 UIApplication *myApp = [UIApplication sharedApplication] ; 5 [myApp setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; 6 [myApp release]; 7 ...
阅读全文
摘要:xcode 4.3.2 use storyboard创建TableView
阅读全文
摘要:xcode 4.3.2从Empty Application使用storyboard显示TabBarController
阅读全文
摘要:xcode 4.3.2 storyboard** 点击软键盘的return键隐藏软键盘.h文件定义IBAction-(IBAction)textFieldReturn:(id)sender;.m文件实现-(IBAction)textFieldReturn:(id)sender{ [sender resignFirstResponder];//关键代码}storyboard中,选中文本框,查看 connections inspector 面板,选择Send Event >> Did End on Exit 事件,连线到文本框,选择 textFieldReturn 即可。** 修改软键
阅读全文

浙公网安备 33010602011771号