const regex = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/i;
var arr = [
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
"21", "22", "23", "24", "25", "26", "27", "28", "29", "30",
"31", "32"
]
var res = [[String]]()
for x in stride(from: 0, through: 31, by: 4) {
res.append(Array(arr[x...x + 3]))
}
var panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(move))
panRecognizer.minimumNumberOfTouches = 1
panRecognizer.maximumNumberOfTouches = 1
panRecognizer.delegate = self
yourView.addGestureRecognizer(panRecognizer)
@objc func move(_ sender: Any) {
if (sender as? UIPanGestureRecognizer)?.state == .changed {
// This will return you location in view
let currentPoint: CGPoint = sender.location(in: view)
// This will return you location in Scrollview
let scrollPoint: CGPoint = sender.location(in: sender.view.superview)
}
}
function uni_ord($u) {
$k = mb_convert_encoding($u, 'UCS-2LE', 'UTF-8');
$k1 = ord(substr($k, 0, 1));
$k2 = ord(substr($k, 1, 1));
return $k2 * 256 + $k1;
}
function utf8_ord($ch) {
$len = strlen($ch);
if($len <= 0) return false;
$h = ord($ch{0});
if ($h <= 0x7F) return $h;
if ($h < 0xC2) return false;
if ($h <= 0xDF && $len>1) return ($h & 0x1F) << 6 | (ord($ch{1}) & 0x3F);
if ($h <= 0xEF && $len>2) return ($h & 0x0F) << 12 | (ord($ch{1}) & 0x3F) << 6 | (ord($ch{2}) & 0x3F);
if ($h <= 0xF4 && $len>3) return ($h & 0x0F) << 18 | (ord($ch{1}) & 0x3F) << 12 | (ord($ch{2}) & 0x3F) << 6 | (ord($ch{3}) & 0x3F);
return false;
}
function utf8_chr($num) {
if($num<128) return chr($num);
if($num<2048) return chr(($num>>6)+192).chr(($num&63)+128);
if($num<65536) return chr(($num>>12)+224).chr((($num>>6)&63)+128).chr(($num&63)+128);
if($num<2097152) return chr(($num>>18)+240).chr((($num>>12)&63)+128).chr((($num>>6)&63)+128).chr(($num&63)+128);
return false;
}
Нет бога, кроме JavaScript и Node.js его пророк.
class MultiScrollViewController: UIViewController {
// ...
override func viewDidLoad() {
super.viewDidLoad()
firstView.delegate = self
secondView.delegate = self
}
// ...
}
extension MultiScrollViewController: UIScrollViewDelegate {
func scrollViewDidScroll(scrollView: UIScrollView) {
firstView.contentOffset = scrollView.contentOffset
secondView.contentOffset = scrollView.contentOffset
}
}
scrollToRow(at:at:animated:)
поместить в нужный метод делегата UITextView
.tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 44 // или что своё
где UITableViewAutomaticDimension, the table view is told to use the Auto Layout constraints and the contents of its cells to determine each cell’s height.