![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
IOS
xmmath
努力奋斗中......
展开
-
iOS开发ASIHTTPRequest直接读取磁盘数据流的请求体的内容
本文为大家介绍了iOS开发ASIHTTPRequest直接读取磁盘数据流的请求体的内容,其中包括ASIFormDataRequests,普通ASIHTTPRequest等等内容。从0.96版本开始,ASIHTTPRequest可以使用磁盘上的数据来作为请求体。这意味着不需要将文件完全读入内存中,这就避免的当使用大文件时的严重内存消耗。使用这个特性的方法有好几种:ASIFormDataReq转载 2014-08-07 19:44:16 · 647 阅读 · 0 评论 -
线程同步的两种防护四
#import "TRViewController.h"@interface TRViewController ()@property (nonatomic)int ticketsCount;@property (nonatomic)int selledCount;@property (nonatomic, strong)NSLock *mylock;@end原创 2014-07-09 11:54:30 · 451 阅读 · 0 评论 -
线程之NSThread二
- (void)viewDidLoad{ [superviewDidLoad]; self.imagePaths = [NSMutableArrayarray]; self.ivs = [NSMutableArrayarray]; // 与网页比较耗时,放在线程中操作 [NSThreaddetachNewThreadSelector原创 2014-07-08 13:36:27 · 476 阅读 · 0 评论 -
线程之NSThread
- (void)viewDidLoad{ [superviewDidLoad]; [NSThreaddetachNewThreadSelector:@selector(run2)toTarget:selfwithObject:Nil];}-(void)run2{ for (int i=0; i30; i++)原创 2014-07-08 11:23:12 · 447 阅读 · 0 评论 -
使用GCD与Opreation
- (void)viewDidLoad{ [superviewDidLoad];// Do any additional setup after loading the view, typically from a nib. self.imagePaths = [NSMutableArrayarray]; dispatch_async(di原创 2014-07-09 11:26:10 · 569 阅读 · 0 评论 -
键盘抬起落下,输入框相应抬起落下
-(void)myViewLayout{ // 旋转不能用frame 要用bounds, self.inputView.frame =CGRectMake(0,self.view.bounds.size.height-self.bottomLayoutGuide.length-45,self.view.bounds.size.width,45原创 2014-06-01 21:43:28 · 762 阅读 · 0 评论 -
XML解析
@interface TRBookXmlParser :NSObjectNSXMLParserDelegate>@property (nonatomic,strong)NSMutableArray *books;@property (nonatomic,strong)TRBook *book;@property (nonatomic,copy)NSStrin原创 2014-07-05 13:58:41 · 450 阅读 · 0 评论 -
bundle是一个目录,看图片就知道了
bundle是一个目录,其中包含了程序会使用到的资源. 这些资源包含了如图像,声音,编译好的代码,nib文件(用户也会把bundle称为plug-in). 对应bundle,cocoa提供了类NSBundle.我们的程序是一个bundle. 在Finder中,一个应用程序看上去和其他文件没有什么区别. 但是实际上它是一个包含了nib文件,编译代码,以及其他资源的目录. 我们把这个目录叫做程序的ma原创 2014-07-05 12:41:10 · 682 阅读 · 0 评论 -
JSON
http://baike.baidu.com/view/136475.htm?fr=aladdin转载 2014-07-05 11:35:38 · 396 阅读 · 0 评论 -
udpSocket
//// ViewController.m// UdpSocket//// Created by tangqinglong on 14-7-3.// Copyright (c) 2014年 tangqinglong. All rights reserved.//#import "ViewController.h"#原创 2014-07-05 09:44:40 · 586 阅读 · 0 评论 -
http同步请求
// http 同步GET请求,将参数直接写在访问路径上。操作简单,不过容易被外界看到,安全性不高,地址最多255字节;-(void)httpSyncroGet{ NSString *path =@"http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx/getMobileCodeInfo?mobi原创 2014-07-05 10:22:49 · 877 阅读 · 0 评论 -
CoreMotion
#import "TRViewController.h"#import #import @interface TRViewController ()AVAudioPlayerDelegate>@property (nonatomic,strong)AVAudioPlayer *player;@property(nonatomic,stro原创 2014-07-09 19:01:35 · 686 阅读 · 0 评论 -
多个对象的保存与读取
-(NSString *)personFileName{ if(!_personFileName)_personFileName =@"person.dat"; return_personFileName;}-(NSString *)filePath{ if(!_filePath)_filePath = [[NSHomeDire原创 2014-06-18 15:12:26 · 649 阅读 · 0 评论 -
使用文件指针操作文件
- (IBAction)useFileHandler{ NSString *documentsPath = [NSHomeDirectory()stringByAppendingPathComponent:@"Documents"]; NSString *filePath = [documentsPath stringByAppendingPathCompon原创 2014-06-18 15:26:11 · 612 阅读 · 0 评论 -
http://mobile.51cto.com/hot-404136.htm
http://mobile.51cto.com/hot-404136.htm转载 2014-08-07 20:52:22 · 826 阅读 · 0 评论 -
在导入asihttprequest包时出问题
导入了libxml2.dylib,但是却提示libxml/HTMLparser.h file not found,那是因为你的开发环境默认的路径无法找到这个libxml2.dylib框架,修改方法:(两种方法都试一下吧)第一种方法:(我的可行) 点击左边项目的根目录,再点击右边的Build Settings,手工输入文字:“Header search paths”,然后单击(或双击,点击弹原创 2014-08-06 16:53:30 · 564 阅读 · 0 评论 -
算法-
//百钱买百鸡的问题算是一套非常经典的不定方程的问题,题目很简单:公鸡5文钱一只,母鸡3文钱一只,小鸡3只一文钱,//用100文钱买一百只鸡,其中公鸡,母鸡,小鸡都必须要有,问公鸡,母鸡,小鸡要买多少只刚好凑足100文钱。+(void)arithmetic{ // 设公鸡 x, 母鸡y,小鸡z, 5x+3y+z/3=100;x int totalMon原创 2014-08-01 01:21:53 · 432 阅读 · 0 评论 -
block函数回调
- (void)viewDidLoad{ // Uncomment the following line to preserve selection between presentations. // self.clearsSelectionOnViewWillAppear = NO; // Uncomment the following原创 2014-07-15 20:48:22 · 492 阅读 · 0 评论 -
自定义类型归档与反归档
#import "TRPerson.h"@implementation TRPerson- (void)encodeWithCoder:(NSCoder *)aCoder{ [aCoder encodeObject:self.nameforKey:@"name"]; [aCoder encodeInt:self.ageforKey:@"age原创 2014-06-17 10:48:10 · 451 阅读 · 0 评论 -
storyboard取得视图控制器
[self.storyboardinstantiateViewControllerWithIdentifier:@"WeibosVc"];原创 2014-08-04 20:36:34 · 429 阅读 · 0 评论 -
storyboard取得视图控制器
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ // Override point for customization after application launch. self.windo原创 2014-08-04 21:22:53 · 579 阅读 · 0 评论 -
数组降序排列
[self.dic.allKeyssortedArrayUsingComparator:^NSComparisonResult(id obj1,id obj2) { if ([obj1 floatValue]<[obj2floatValue]) { returnNSOrderedAscending;原创 2014-07-12 15:16:06 · 1023 阅读 · 0 评论 -
文件的copy与合并
- (IBAction)copyFile{ //source file : source.txt ==> source copy.txt NSString *documentsPath = [NSHomeDirectory()stringByAppendingPathComponent:@"Documents"]; NSString *source原创 2014-06-18 15:51:40 · 712 阅读 · 0 评论 -
NSNotificationCenter消息中心
发射方:- (void)publish{ //单例(唯一)的通知中心 NSNotificationCenter *center = [NSNotificationCenterdefaultCenter]; //通知的内容 NSDictionary *userinfo =@{NewsNotificationTitleKey:原创 2014-05-30 23:39:30 · 582 阅读 · 0 评论 -
ios面试
Object-C有多继承吗?没有的话用什么代替?cocoa 中所有的类都是NSObject的子类多继承在这里是用protocol 委托代理来实现的你不用去考虑繁琐的多继承 ,虚基类的概念.ood的多态特性 在 obj-c中通过委托来实现.Object-C有私有方法吗?私有变量呢?objective-c – 类里面的方法只有两种,静态方法和实例方法. 这似原创 2014-07-22 17:16:21 · 435 阅读 · 0 评论 -
Core Animation CALayer动画
-(UIImage*) circleImage:(UIImage*) image withParam:(CGFloat) inset{ UIGraphicsBeginImageContext(image.size);CGContextRef context =UIGraphicsGetCurrentContext(); //设置线宽 CGC原创 2014-05-27 17:52:40 · 541 阅读 · 0 评论 -
图片动画
- (void)viewDidLoad{ [superviewDidLoad];self.imageView.image = [UIImageanimatedImageNamed:@"ship-anim"duration:0.05];}原创 2014-05-21 23:48:13 · 463 阅读 · 0 评论 -
NSTimer
- (void)viewDidLoad{ [superviewDidLoad];[NSTimerscheduledTimerWithTimeInterval:0.5target:selfselector:@selector(connect:)userInfo:nilrepeats:YES];}- (void)connect:(N原创 2014-05-21 23:53:32 · 400 阅读 · 0 评论 -
AutoLayout NSLayoutConstraint VFL
- (void)viewDidLoad{ [superviewDidLoad];UIButton *button1 = [UIButtonbuttonWithType:UIButtonTypeSystem]; [button1 setTitle:@"Button1"forState:UIControlStateNormal]; bu原创 2014-05-21 23:40:21 · 704 阅读 · 0 评论 -
在自己实现的ios画图程序中如何实现橡皮擦功能
在自己实现的ios画图程序中如何实现橡皮擦功能 (2012-01-09 09:45:57)转载▼通过cgcontextref来画图的时候,实现橡皮擦功能的方式有两种:1. 将画笔设置为背景色来实现橡皮擦功能。这种情况适用于当前设置context的blend mode为normal的时候,即CGContextSetBlendMode(context, kCGBle翻译 2014-05-14 03:24:18 · 3268 阅读 · 0 评论 -
UItableViewController
需要回答这三个问题:#pragma mark - Table view data source- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1;}- (NSInteger)tableView:(UITableView *)tableView numb原创 2014-05-17 10:57:06 · 486 阅读 · 0 评论 -
代码创建视图,使用autoresizing
- (void)viewDidLoad{ [superviewDidLoad]; UILabel *label = [[UILabelalloc]initWithFrame:CGRectMake(240,20, 60, 35)]; label.text =@"Hello"; label.backgroundColor = [原创 2014-05-17 12:43:13 · 477 阅读 · 0 评论 -
关闭AutoLayOut,使用手动布局
-(void)addButton{ CGRect frame; frame.origin.y =self.topLayoutGuide.length+20; frame.size.height =40; frame.size.width = (self.view.bounds.size.width - 20*2-10)/2;原创 2014-05-17 12:28:07 · 946 阅读 · 0 评论 -
IOS画图
CGContextRef context =UIGraphicsGetCurrentContext(); CGContextSaveGState(context); UIBezierPath *path = [UIBezierPathbezierPath]; CGPoint center =CGPointMake(self.bo原创 2014-05-07 23:27:10 · 561 阅读 · 0 评论 -
使用Xib创建UICollectionView
步骤1、创建继承原创 2014-05-01 18:31:49 · 1842 阅读 · 0 评论 -
设置UINavigationController的navigationBar标题,实现自定义字体、大小、颜色。
-(void)setNaviTiTleByLabel{ //创建一个label可以调整字体大小,颜色 //必须设置Frame,宽度与高度要设置正确,x,y无论设置为多少都是居中显示,如果不设置Frame整个标题都不会显示,但是如果左面按钮过长,标题会向另一边偏移。 UILabel* label = [[UILabelalloc]initWithF原创 2014-05-01 11:18:40 · 4483 阅读 · 0 评论 -
iOS路径的几种操作
NSString *path =@"/Users/tarena/Documents/Core iOS"; //1. 加路径内容,自动加上/ NSString *newPath = [pathstringByAppendingPathComponent:@"Model_And_Storage"]; NSLog(@"path:%@", newPath原创 2014-06-03 21:49:34 · 651 阅读 · 0 评论 -
AutoLayout NSLayoutConstraint
- (void)viewDidLoad{ [superviewDidLoad]; UILabel *label = [[UILabelalloc]init]; label.text =@"AutoLayout"; label.backgroundColor = [UIColorlightGrayColor];原创 2014-05-21 23:07:20 · 512 阅读 · 0 评论 -
block回调
丈母娘:女儿,结婚给我生个大胖小子(声明方法,至于怎么生,那是夫妻之间的事)结婚后......老婆:老公,咱们生个娃吧(实现方法...)丈母娘:女儿,把娃带回家看看(回调方法)如果把结婚看作丈母娘定的协议,必须遵循协议,才能使用这个方法。block作为函数测参数来回调就没有那么麻烦。丈母娘要求变为只要生个娃,你们就能在一起。协议很好理解,blockhu原创 2014-07-16 11:12:58 · 607 阅读 · 0 评论 -
iOS笔记 Collection View Controller
1. tag属性 1.1 UIView的属性 所有的视图、控件都有 1.2 作用: 标识父视图中的子视图,给每一个子视图一个唯一的编号 如此,就可以从父视图中获取指定tag值的那个子视图 self.view (父视图) UILabel *label1 = @"";原创 2014-05-06 21:00:40 · 989 阅读 · 0 评论