iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

Passing data between View Controllers using Segue

I am new to iOS. I am facing a problem passing the data between ViewControllers. I have three viewControllers (view_1 ,view_2 and view_3). Here my setup:- Select view_1 pushes view_2 pushes view_3 I want to send the ViewController reference(id) of ‘view_1’ to ‘view_3’. so i include include “view_3” in ‘view_1’ and set the value into […]

Displaying splash screen for longer than default seconds

Is it possible to display the Default.png for a specified number of seconds? I have a client that wants the splash screen displayed for longer than its current time. They would like it displayed for 2 – 3 seconds.

Draw dotted (not dashed!) line, with IBDesignable in 2017

It’s easy to draw a dashed line with UIKit. So: CGFloat dashes[] = {4, 2}; [path setLineDash:dashes count:2 phase:0]; [path stroke]; Is there any way way to draw a genuine dotted line? Any ideas? Since this question is really old and nobody put in a full @IBDesignable solution, here it is… Hope it saves someone […]

Does ARC work with Core Graphics objects?

I recently started a new project using Automatic Reference Counting (ARC). When I assigned the contents of a CALayer: UIView* view = … UIImage* image = … view.layer.contents = image.CGImage I got an error Implicit conversion of a non-Objective-C pointer type ‘CGImageRef’ to ‘id’ is disallowed with ARC Simply casting the CGImageRef to id hides […]

Display UIViewController as Popup in iPhone

Since there is no complete, definitive answer to this common recurring question, I’ll ask and answer it here. Often we need to present a UIViewController such that it doesn’t cover full screen, as in the picture below. Apple provides several similar UIViewController, such as UIAlertView, Twitter or Facebook share view controller, etc.. How can we […]

Programmatically selecting text in an input field on iOS devices (mobile Safari)

How do you programmatically select the text of an input field on iOS devices, e.g. iPhone, iPad running mobile Safari? Normally it is sufficient to call the .select() function on the <input … /> element, but this does not work on those devices. The cursor is simply left at the end of the existing entry […]

UIGestureRecognizer and UITableViewCell issue

I am attaching a UISwipeGestureRecognizer to a UITableViewCell in the cellForRowAtIndexPath: method like so: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @”Cell”; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; UISwipeGestureRecognizer *gesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(didSwipe:)]; gesture.direction = UISwipeGestureRecognizerDirectionRight; [cell.contentView addGestureRecognizer:gesture]; […]

Custom Annotation view for userlocation not moving the mapview

Can we have custom annotation view for the users current location in iOS? I need to remove the blue dot (with circles) with my own custom view (say some ping pin). Is it possible to do this? If we do, does this pin move to new location when there is change in user’s location? Or […]

AutoLayout with hidden UIViews?

I feel like it’s a fairly common paradigm to show/hide UIViews, most often UILabels, depending on business logic. My question is, what is the best way using AutoLayout to respond to hidden views as if their frame was 0x0. Here is an example of a dynamic list of 1-3 features. Right now I have a […]

How does the iOS app Display Recorder record the screen without using private API?

The iOS app Display Recorder claims to be able to record the screen of an iOS device, even while it is in the background. Given that UIGetScreenImage() is private API and will lead to a rejection on application submission when detected by the static analysis Apple runs, how were they able to do this recording […]