UIButton
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setFrame:CGRectMake(100, 200, 100, 40)];
[btn setTitle:@"开始制作" forState:UIControlStateNormal];
[btn setBackgroundColor:[UIColor redColor]];
[self.view addSubview:btn];
UIButton
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setFrame:CGRectMake(100, 200, 100, 40)];
[btn setTitle:@"开始制作" forState:UIControlStateNormal];
[btn setBackgroundColor:[UIColor redColor]];
[self.view addSubview:btn];
在 controller 中加入以下代码
#pragma mark 强制横屏(针对present方式)
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscapeRight;
| // isMobile | |
| const getIsMobile = () => { | |
| let isMobile = false; | |
| try { | |
| isMobile = !!((window.navigator && window.navigator.standalone) || navigator.userAgent.match('CriOS') || navigator.userAgent.match(/mobile/i)); | |
| } catch (ex) { | |
| // continue regardless of error | |
| } |
| # This config file was created for myself (@shanskc). You may want to add or remove some rules to make efficient use of the Internet. | |
| # Update: Rules and configuration tuning | |
| # 从243开始Surge 加入了proxy和rule分离的配置Override,此文件为rules main.conf,在你的proxy中你可以引入此conf | |
| # eg: 下面为你的proxy.conf,只需引入此main.conf 即可. | |
| # -----START----- | |
| # #!PROXY-OVERRIDE:main.conf | |
| # | |
| # [Proxy] | |
| # Proxy = custom, ip, port, Methor, password | |
| # -----END----- |
| // Db.js | |
| var conf = require('../config'), | |
| mysql = require('mysql'); | |
| var Db = function() { | |
| this.db = null; | |
| this.table = ''; | |
| }; | |
| Db.prototype = { |
| <? | |
| /** | |
| * | |
| * 根据经纬度计算距离 单位(米) | |
| */ | |
| function getdistance($lat1, $lng1, $lat2, $lng2) { | |
| $r = 6378.137 * 1000; // 地球半径, 公里的话不用*1000 | |
| $dlat = deg2rad($lat2 - $lat1); | |
| $dlng = deg2rad($lng2 - $lng1); | |
| $a = pow(sin($dlat / 2), 2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * pow(sin($dlng / 2), 2); |
| //给据精度和纬度计算相距距离 | |
| function rad(d) { | |
| return d * Math.PI / 180.0; | |
| } | |
| function GetDis(lat1, lng1, lat2, lng2) { | |
| var radLat1 = rad(lat1); | |
| var radLat2 = rad(lat2); | |
| var a = radLat1 - radLat2; | |
| var b = rad(lng1) - rad(lng2); | |
| var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a/2),2) + |
| //1. 隐藏 Status Bar | |
| override func prefersStatusBarHidden() -> Bool { | |
| return true | |
| } | |
| //2. 圆角 | |
| view.layer.conerRadius = 10 | |
| view.clipsToBounds = true |