- 浏览: 11738 次
-
最新评论
文章列表
沙盒机制的使用
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory ,NSUserDomainMask, YES);
NSString *docDir = [paths objectAtIndex:0];
//以上两行是获取Document目录
NSString *filePath = [docDir stringByAppendingPathComponent:@"oderinfo.plist"];
//“”内是自己起的名字 相当 ...
Pos.h
#import <Foundation/Foundation.h>
@interface Pos : NSObject
//@property (nonatomic, retain) NSString *name;//声明属性 常用 具有set和get功能
-(void) setName :(NSString *) theName;
-(void) setUnit :(NSString *) theUnit;
-(void) setPrice :(double) thePrice;
-(void) setCount :(int) the ...
在A页面进行操作,使得B页面有所更改的时候需要用到通知机制,在A页面发送通知,在B页面接收A页面发来的通知从而对B页面进行操作。
首先在viewDidload里注册一个通知监听器
[[NSNotificationCenter defaultCenter]addObserver:self sel ...
UILabel *labelp = [[UILabel alloc]initWithFrame:CGRectMake(10, 50,70, 50)]; // 确定labelp的位置
labelp.text = @"人:";//labelp的内容
labelp.textColor = [UIColor blackColor];//labelp的文字颜色
[self.view addSubview:labelp];//加载labelp
// 创建一个内容为 人 的label
UILabel *label ...
Viewcontroller.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,retain)NSArray *textlist;
//定义一个数组名为textlist
@property(nonatomic,retain)NSArray *imagelist;
//定义 ...
UIButton *button (自己起的名字) = [UIButton buttonWithType:UIButtonTypeRoundedRect]; //定义一个样式为圆角的button
button.frame = CGRectMake(35, 70, 300, 50); //button的位置
[button setTitle:@"帮订餐" forState:UIControlStateNormal];
//设置button的title
button.titleLabel.font = [UIFont syste ...
初学IOS对编程的逻辑进行的训练,通过编写一个简单的计算机程序来锻炼编程需要的罗辑思维。
Calc.h
// Calc.h// practice_calc//// Created by 李旗 on 15/11/2.// Copyright (c) 2015年 李旗. All rights reserved.//
#import <Foundation/Foundation.h>
@interface Calc : NSObject- (void) setAccumulator: (double) value;
- (voi ...