Determine vertical direction of a touchmove

I had some issues in Ipad and solved it with two events var ts; $(document).bind(‘touchstart’, function (e){ ts = e.originalEvent.touches[0].clientY; }); $(document).bind(‘touchend’, function (e){ var te = e.originalEvent.changedTouches[0].clientY; if(ts > te+5){ slide_down(); }else if(ts < te-5){ slide_up(); } });

How do I programmatically set the Return Key for a particular UITextField?

For the first UITextField, Read THIS tutorial on how to create a button on a Keyboard. You can learn the logic from there and use a Next button instead of Done button. //if you just want to make it appear NEXT// textField.returnKeyType = UIReturnKeyNext; And for the second UITextField, use… // for DONE // textField.returnKeyType … Read more

UIScrollView custom paging size

There is a UIScrollView delegate method you can use. Set your class as the scroll view’s delegate, and then implement the following: – (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset { CGFloat kMaxIndex = 23; CGFloat targetX = scrollView.contentOffset.x + velocity.x * 60.0; CGFloat targetIndex = 0.0; if (velocity.x > 0) { targetIndex = ceil(targetX / … Read more

iOS: UITableView cells with multiple lines?

You can use the existing UILabel views in the UITableViewCell for this. The secret is to do the following: cell.textLabel.numberOfLines = 0; cell.textLabel.lineBreakMode = UILineBreakModeWordWrap; By default, the UILabel only allows 1 line of text. Setting numberOfLines to 0 basically removes any limitations on the number of lines displayed. This allows you to have multiple … Read more