Mobile Development Articles

Page 148 of 156

How to draw a route between two locations using MapKit in Swift?

Vrundesha Joshi
Vrundesha Joshi
Updated on 30-Jul-2019 962 Views

To draw a route between two Locations on map we need to have co-ordinates of both those locations.Once we have the co-ordinates of both locations we can use the below given function to show the line between two points on map. In this example I’ll be using two random location as two points.func getDirections(loc1: CLLocationCoordinate2D, loc2: CLLocationCoordinate2D) {    let source = MKMapItem(placemark: MKPlacemark(coordinate: loc1))    source.name = "Your Location"    let destination = MKMapItem(placemark: MKPlacemark(coordinate: loc2))    destination.name = "Destination"    MKMapItem.openMaps(with: [source, destination], launchOptions: [MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving]) }We’ll call this function in ViewDidLoad for this tutorial to show the ...

Read More

Exact Radius and Size of iPhone App Icons

Rishi Rathor
Rishi Rathor
Updated on 30-Jul-2019 741 Views

Every iPhone application needs some icons that are displayed when certain events occur, like when some new notification comes, or the icon for home screen or the icon that is displayed on spotlight.All these icons have different size properties but apart from their size there are some common properties they have. Let’s see them first.The icons should be in .png formatThe icons should be flat and should not have transparency.The images should be squared, without any round corners.For any iOS device the icons size for app store is 1024px * 1024pxOther app icon sizes are usually bases on 1x, 2x ...

Read More

How to detect which iOS version is running on the device?

Anvi Jain
Anvi Jain
Updated on 30-Jul-2019 584 Views

When working on iOS applications, we sometimes need to know the version that's running on an iPhone device. In this article we'll learn how to find the iOS version being used, using an iOS Application.Create an iOS application and in it's viewController's view did load function write the following code.print(" System version - ",UIDevice.current.systemVersion)This will return the iOS version of the device currently in use. Like current version of my simulator is iOS 12.0 hence the result comes asSystem Version – 12.0

Read More

Where are iOS simulator screenshots stored?

Vrundesha Joshi
Vrundesha Joshi
Updated on 30-Jul-2019 2K+ Views

The screenshots taken on an simulator are stored usually on desktop of the system that you are using.There are multiple scenarios in which screenshots could have been taken, some of them are mentioned below.When the images are taken using "Command" + S, or from File menu's New Screenshot option, They are usually stored by name similar to "Simulator Screen Shot - iPhone 7 Plus - 2018-12-26 at 18.18.14" which consists of Simulator running currently followed by date in YYYY-MM-DD at HH:MM:SS format.If they are taken with mac's "Command + shift +3" or "command + shift + 4" buttons, they are ...

Read More

How to compare two NSDates in iPhone/iOS?

Jennifer Nicholas
Jennifer Nicholas
Updated on 30-Jul-2019 197 Views

In this article we'll see how to compare two NSDates in swift. First of all we'll need to create two NSDates.We'll do it in playground instead of simulator this time.First Let's create two different dates.let dateOne = NSDateComponents() dateOne.day = 5 dateOne.month = 6 dateOne.year = 1993 let dateTwo = NSDateComponents() dateTwo.day = 4 dateTwo.month = 2 dateTwo.year = 1995Using these date components we'll create dates and then compare themlet cal = NSCalendar.current let FirstDate = cal.date(from: dateOne as DateComponents) let secondDate = cal.date(from: dateTwo as DateComponents)Now to compare them we'll use a if condition.if secondDate!.compare(firstDate!) == .orderedAscending {   ...

Read More

What is difference between UITableViewController and UIViewController?

Rishi Rathor
Rishi Rathor
Updated on 30-Jul-2019 662 Views

UItableViewController and UIViewController are two different objects of iOS UIKit framework. Both are used for different purpose.A UIViewController class manages a ViewContoller which is responsible for actions that happen within that View controller. This class is aware of actions that happen on view controller, like ViewDidLoad, ViewWillApper, ViewDidAppear, ViewWillDisapper, ViewDidDisapper.Whereas, A UITableViewController is responsible for managing a table, it's data and it's events using UITableViewDataSource, UITableViewDelegate.A UITableViewController conforms to UIViewController, UITableViewDataSource and UITableViewDelegate to implement table view.Below is an example of a class implementing UIViewController.class ViewController : UIViewController { @IBOutlet weak var sampleView: UIView! ...

Read More

How to set background for Navigation Bar in iOS?

Vrundesha Joshi
Vrundesha Joshi
Updated on 30-Jul-2019 1K+ Views

To set the background color for a navigation bar we can either do it programmatically or through the storyboard if it is on storyboard.Method 1Let's see how to change the background color of a navigation bar through the storyboard editor.Create a new project, select it's view controller and embed in navigation controller.Select the navigation bar and go to It's attribute inspector.This is how it looks in the Xcode 10. You can select the tint color from there and it will be changed for the navigation controller.Method 2Programmatically changing the navigation background.To programmatically change it, go to the view controller and ...

Read More

How to insert new cell into UITableView using Swift?

Rishi Rathor
Rishi Rathor
Updated on 30-Jul-2019 1K+ Views

To insert a new cell into UITableView we'll first have to create a table view cell and then add it to the table view using Cell for row at method of Table view.We can create a cell using Storyboard or by creating a nib of class UITableViewCell.In the View controller drag and drop a table view and connect it's outlet to the ViewController class.Let's create a cell in the table view we just created and create it's class, call it CustomCell, and assign the class to cell.Give it an identifier "CustomCell"Add a label in the cell and change it to ...

Read More

How to set Adapter to Auto Complete Text view?

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 2K+ Views

 Before getting into an example, we should know what is autocomplete textview in android. Autocomplete textview is just like an edit text and it is a subclass of editext, but it is going to show suggestion from a list as a dropdown list. We have to set up Threshold value to auto-complete text view. for example, we have set it up Threshold as 1 so if user enters one letter is going to give suggestion according to Threshold letter.This example demonstrates about how to set up an adapter to auto-complete Textview.Step 1 − Create a new project in Android Studio, ...

Read More

How to use android date change listener ?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 1K+ Views

Before getting into the example, we should know what is date picker and how does it work in android. The date picker is a subclass of frame layout and it allows to select the date, month and year.This example demonstrates how to use android date change listener.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have declare date picker to select the date. when you select the ...

Read More
Showing 1471–1480 of 1,551 articles
« Prev 1 146 147 148 149 150 156 Next »
Advertisements