2015年11月23日星期一
2015年10月23日星期五
在浏览器上获取手机的型号,浏览器等 信息(JS)
<script language="javascript">
window.onload = function () {
alert("1");
var u = navigator.userAgent;
if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {//安卓手机
alert("安卓手机");
// window.location.href = "mobile/index.html";
} else if (u.indexOf('iPhone') > -1) {//苹果手机
// window.location.href = "mobile/index.html";
alert("苹果手机");
} else if (u.indexOf('Windows Phone') > -1) {//winphone手机
alert("winphone手机");
// window.location.href = "mobile/index.html";
}
}
</script>
window.onload = function () {
alert("1");
var u = navigator.userAgent;
if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {//安卓手机
alert("安卓手机");
// window.location.href = "mobile/index.html";
} else if (u.indexOf('iPhone') > -1) {//苹果手机
// window.location.href = "mobile/index.html";
alert("苹果手机");
} else if (u.indexOf('Windows Phone') > -1) {//winphone手机
alert("winphone手机");
// window.location.href = "mobile/index.html";
}
}
</script>
2015年6月2日星期二
获取绑定的页面类(instantiateViewControllerWithIdentifier)
setupViewControll=[self.storyboard instantiateViewControllerWithIdentifier:@"SetupViewControllView"];
这个是绑定页面的. 当对应页面绑定对应类时 使用这个就可以直接拿过来 页面的绑定类了
之后可以直接用该页面的控件
比如
UIViewController A
UIViewController B{
@property(weak,nonatomic)IBOutlet UISwitch *swichControl;
}
在A页面里
有 B b=[self.storyboard instantiateViewControllerWithIdentifier:@"B"];
那么 b.swichControll就是页面B的 UISwitch控件了
2015年6月1日星期一
2015年5月31日星期日
跳转页面(presentViewController)与关闭也页面
跳转
[self presentViewController:setupViewControll animated:YES completion:nil];
关闭
关闭
[setupViewControll dismissViewControllerAnimated:YES completion:nil];
2015年5月27日星期三
addSubview和 insertSubView 区别
A addSubview B 是将B直接覆盖在A的最上层
A insertSubView B AtIndex:2 是将B插入到A的子视图index为2的位置(最底下是0)
A insertSubView B aboveSubview:C 是将B插入A并且在A已有的子视图C的上面
A insertSubView B belowSubview:C 是将B插入A并且在A已有的子视图C的下面
2015年3月26日星期四
delegate(委托)
delegate是 说白了 我要做的事儿 委托别人去做。
我要做什么事儿那必须得把自己要做的事儿发布出去,至于谁要接这个委托,那就要在委托方进行委托操作了。
@interface 接受委托方:要进行委托的类<委托名称(这个名称是随意)>
{
类A *view;//假设 -(void)委托方法A:NSString *param1; 这个方法在 类A下
}
-(void)委托方法A:NSString *param1;
@end
@implementation 委托方
-viewDiaload{
view=[[类A alloc] init];
//把这个类名设置为委托,那么在别的类中调用了 类A中的 委托方法A的话那么就会进入到 接受委托方类里的 委托方法A中去, 因为在interface里已经定义里 类A中的相同类型的方法(注意如果方法名要跟类A里的保持一致).
[view delegate:self];
}
-(void)委托方法A:NSString *param1{
}
@end
我要做什么事儿那必须得把自己要做的事儿发布出去,至于谁要接这个委托,那就要在委托方进行委托操作了。
@interface 接受委托方:要进行委托的类<委托名称(这个名称是随意)>
{
类A *view;//假设 -(void)委托方法A:NSString *param1; 这个方法在 类A下
}
-(void)委托方法A:NSString *param1;
@end
@implementation 委托方
-viewDiaload{
view=[[类A alloc] init];
//把这个类名设置为委托,那么在别的类中调用了 类A中的 委托方法A的话那么就会进入到 接受委托方类里的 委托方法A中去, 因为在interface里已经定义里 类A中的相同类型的方法(注意如果方法名要跟类A里的保持一致).
[view delegate:self];
}
-(void)委托方法A:NSString *param1{
}
@end
2015年3月25日星期三
IOS页面的笔记--【storyboard调试画面大小】
首先看一下苹果屏幕都有哪些以及对应的尺寸.
1. 在storyboard上调节屏幕大小
1-1: 首先取消自适应选项: .storyboard->点击viewcontroll->把Use Size Classes去掉
1-2: 看如下图选择屏幕Size(大小是根据上边的图片可以适配)
2015年3月5日星期四
订阅:
博文 (Atom)