当前位置:  编程技术>移动开发
本页文章导读:
    ▪readonly 跟disabled        readonly 和disabled怎样使input中的内容为只读,也就是说不让用户更改里面的内容。 <input type="text" name="input1" value="中国" /> <input type="text" name="input1" value="中国" readonly /> <input type="text.........
    ▪ 运用XCode4.3.2更改项目名        使用XCode4.3.2更改项目名1.选择项目,在工具栏选择 View->Utilities->Show File Inspector 2.更改Project Name,改完名字后按回车 3.按Rename等系统修改完后按OK 4.完成后,你会发现还有一个地方.........
    ▪ CoreText作图基本知识       CoreText绘制基本知识 首先,进行创建一个UIView的子类,并实现如下代码: - (void)drawRect:(CGRect)rect { // Drawing code. //创建要输出的字符串 NSString *longText = @”袁唯来来 Lorem ipsum dolor sit amet, Before th.........

[1]readonly 跟disabled
    来源: 互联网  发布时间: 2014-02-18
readonly 和disabled
怎样使input中的内容为只读,也就是说不让用户更改里面的内容。

<input type="text" name="input1" value="中国" />
<input type="text" name="input1" value="中国" readonly />
<input type="text" name="input1" value="中国" disabled />
最好不要用disabled,不然就无法取出里面的值了.

<input type="text" name="input1" value="中国" readonly="true" />
<input type="text" name="input1" value="中国" readonly />
区别:
1.disabled  --  完全不可编辑,并且是不能复制的。
2.readonly   --  不可编辑,但是是可以复制。
3.Readonly只针对input(text / password)和textarea有效,而disabled对于所有的表单元素都有效,包括select, radio, checkbox, button等。
4.表单元素在使用了disabled后,当我们将表单以POST或GET的方式提交的话,这个元素的值不会被传递出去,而readonly会将该值传递出去

同点:
使input不可编辑。

    
[2] 运用XCode4.3.2更改项目名
    来源: 互联网  发布时间: 2014-02-18
使用XCode4.3.2更改项目名

1.选择项目,在工具栏选择 View->Utilities->Show File Inspector



2.更改Project Name,改完名字后按回车



3.按Rename等系统修改完后按OK


4.完成后,你会发现还有一个地方的名字没改


5.点击工程名,选择 Edit Scheme,然后选择 Manage Scheme,更改完Scheme的名字后按ok



6.修改完项目名后先Clean,然后重新运行项目就可以了



    
[3] CoreText作图基本知识
    来源: 互联网  发布时间: 2014-02-18
CoreText绘制基本知识

首先,进行创建一个UIView的子类,并实现如下代码:

- (void)drawRect:(CGRect)rect {
// Drawing code.

//创建要输出的字符串

NSString *longText = @”袁唯来来 Lorem ipsum dolor sit amet, Before the iPad was released you had basically two ways how to get text on screen. Either you would stick with UILabel or UITextView provided by UIKit or if you felt hard-core you would draw the text yourself on the Quartz level incurring all the headaches induced by having to mentally switch between Objective-C and C API functions.\
As of iOS 3.2 we gained a third alternative in Core Text promising full control over styles, thread safety and performance. However for most of my apps I did not want to break 3.x compatibility and so I procrastinated looking at this powerful new API. Apps running only on iPads could have made use of Core Text from day 1, but to me it made more sense supporting iPad via hybrid apps where the iPhone part would still be backwards compatible.\
Now as the year has turned the adoption of 4.x on all iOS platforms is ever more accelerating. Many new iPads where found under the Christmas tree and by now even the most stubborn people (read needing 3.x for jailbreaking and sim-unlocking) have little reason to stick with 3.x. Thus we have almost no incentive left to stick with 3.x compatibility. Yay!”;


//创建AttributeString
NSMutableAttributedString *string = [[NSMutableAttributedString alloc]
initWithString:longText];

//创建字体以及字体大小
CTFontRef helvetica = CTFontCreateWithName(CFSTR(”Helvetica”), 14.0, NULL);
CTFontRef helveticaBold = CTFontCreateWithName(CFSTR(”Helvetica-Bold”), 14.0, NULL);

//添加字体 目标字符串从下标0开始到字符串结尾
[string addAttribute:(id)kCTFontAttributeName
value:(id)helvetica
range:NSMakeRange(0, [string length])];

//添加字体 目标字符串从下标0开始,截止到4个单位的长度
[string addAttribute:(id)kCTFontAttributeName
value:(id)helveticaBold
range:NSMakeRange(0, 4)];

//添加字体 目标字符串从下标6开始,截止到5个单位长度
[string addAttribute:(id)kCTFontAttributeName
value:(id)helveticaBold
range:NSMakeRange(6, 5)];

//添加字体 目标字符串从下标109开始,截止到9个单位长度
[string addAttribute:(id)kCTFontAttributeName
value:(id)helveticaBold
range:NSMakeRange(109, 9)];

//添加字体 目标字符串从下标223开始,截止到6个单位长度
[string addAttribute:(id)kCTFontAttributeName
value:(id)helveticaBold
range:NSMakeRange(223, 6)];

//添加颜色,目标字符串从下标0开始,截止到4个单位长度
[string addAttribute:(id)kCTForegroundColorAttributeName
value:(id)[UIColor blueColor].CGColor
range:NSMakeRange(0, 4)];

//添加过程同上
[string addAttribute:(id)kCTForegroundColorAttributeName
value:(id)[UIColor redColor].CGColor
range:NSMakeRange(18, 3)];

[string addAttribute:(id)kCTForegroundColorAttributeName
value:(id)[UIColor greenColor].CGColor
range:NSMakeRange(657, 6)];

[string addAttribute:(id)kCTForegroundColorAttributeName
value:(id)[UIColor blueColor].CGColor
range:NSMakeRange(153, 6)];

//创建文本对齐方式
CTTextAlignment alignment = kCTLeftTextAlignment;//左对齐 kCTRightTextAlignment为右对齐
CTParagraphStyleSetting alignmentStyle;
alignmentStyle.spec=kCTParagraphStyleSpecifierAlignment;//指定为对齐属性
alignmentStyle.valueSize=sizeof(alignment);
alignmentStyle.value=&alignment;

//创建文本行间距
CGFloat lineSpace=5.0f;//间距数据
CTParagraphStyleSetting lineSpaceStyle;
lineSpaceStyle.spec=kCTParagraphStyleSpecifierLineSpacing;//指定为行间距属性
lineSpaceStyle.valueSize=sizeof(lineSpace);
lineSpaceStyle.value=&lineSpace;

//创建样式数组
CTParagraphStyleSetting settings[]={
alignmentStyle,lineSpaceStyle
};

//设置样式
CTParagraphStyleRef paragraphStyle = CTParagraphStyleCreate(settings, sizeof(settings));

//给字符串添加样式attribute
[string addAttribute:(id)kCTParagraphStyleAttributeName
value:(id)paragraphStyle
range:NSMakeRange(0, [string length])];

// layout master
CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(
(CFAttributedStringRef)string);

CGMutablePathRef leftColumnPath = CGPathCreateMutable();
CGPathAddRect(leftColumnPath, NULL,
CGRectMake(0, 0,
self.bounds.size.width,
self.bounds.size.height));

CTFrameRef leftFrame = CTFramesetterCreateFrame(framesetter,
CFRangeMake(0, 0),
leftColumnPath, NULL);

// flip the coordinate system
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetTextMatrix(context, CGAffineTransformIdentity);
CGContextTranslateCTM(context, 0, self.bounds.size.height);
CGContextScaleCTM(context, 1.0, -1.0);

// draw
CTFrameDraw(leftFrame, context);

// cleanup

CGPathRelease(leftColumnPath);
CFRelease(framesetter);
CFRelease(helvetica);
CFRelease(helveticaBold);
[string release];
UIGraphicsPushContext(context);


}


    
最新技术文章:
▪Android开发之登录验证实例教程
互联网 iis7站长之家
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3