Found 98 Articles for IPhone/iPad

How to use Swift to run in background to provide current location?

Samual Sam
Updated on 30-Jul-2019 22:30:24

586 Views

To get background location in swift we need to go through a few stepsGet the permissions from the user, in your info.plist file add Privacy- Location always andwhen in usage Description, Privacy – When in usage description and add their respective description.After that, you need to import the CoreLocation framework which will enable you to use all the location related libraries and methods. Then you need to get permission from the user to use the location. For that, we need to create a CLLocationManager Object and get authorization.var locationManager: CLLocationManager? override func viewDidLoad() { super.viewDidLoad() ... Read More

How to develop or migrate apps for iPhone 5 screen resolution?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

69 Views

At the release of iPhone 5, it’s resolution and aspect ratio was different (640 x 1136 pixels), hence it was tough to migrate applications from iPhone 4 sizes to the newer iPhone. But later with the release of iOS 8, size classes and abstract screen sizes were also introduced to make it easier. As of now, applications for almost all sizes can be developed with Xcode storyboard editor.Apart from storyboard editor, you can also change the launch image. Let’s see the first method.Change the launch image to Default-568h@2x.png. Change the size to be 1136x640.Go to info.plist and remove the value ... Read More

How to send an attachment in email using Swift?

Samual Sam
Updated on 30-Jun-2020 05:44:32

370 Views

To send an email from our iPhone device using our application we need to import the MessageUI framework of iOS SDK. After importing the framework in your application, drag and drop a button on the view controller. Add empty action for that button.Now add the following code in your view controller.funccomposeEmail(to email: String, subject: String, Body: String) {    if( MFMailComposeViewController.canSendMail()) {       letmailComposer = MFMailComposeViewController()       mailComposer.mailComposeDelegate = self       mailComposer.setToRecipients([email])       mailComposer.setSubject(subject)       mailComposer.setMessageBody(Body, isHTML: true)       letpathPDF = "\(NSTemporaryDirectory())result.pdf"       if let fileData ... Read More

How to insert new cell into UITableView using Swift?

Rishi Rathor
Updated on 30-Jul-2019 22:30:24

859 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 create a WebView in iOS/iPhone?

Anvi Jain
Updated on 30-Jun-2020 05:24:12

422 Views

To create a web view in iOS we'll use Webkit framework of iOS. Previously UIWebView was used to create web views but that has been deprecated now.We'll use WebKit View in this project.Create a new project and from object library drag and drop webKit View to the ViewController.Give constraints as per your requirement.Make an outlet connection to the webKit in ViewController.We'll open facebook in this example using the code below.let url = URL(string: "https://www.facebook.com") override func viewDidLoad() {    super.viewDidLoad()    let request = URLRequest.init(url: self.url!)    self.wbView.load(request) }Now finally we need to add a key App Transport Security Settings ... Read More

How to set background for Navigation Bar in iOS?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:24

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

What is difference between UITableViewController and UIViewController?

Rishi Rathor
Updated on 30-Jul-2019 22:30:24

379 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 compare two NSDates in iPhone/iOS?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:24

98 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

How can I send mail from an iPhone application?

Anvi Jain
Updated on 30-Jun-2020 05:25:17

106 Views

To send an email from our application we'll need to use URL Schemes and some action on event of which the email will be sent. We can not actually send email from the application, unless it is an mailing application and we use MessageUI framework of iOS, but we can open some email app from our application with prefilled email and subject.We'll see both the ways of doing this.Let's see how we can open the MAIL app of iOS with an example.Create a project and on its first view controlleradd a button and change it's text to open "open e-mail", ... Read More

Where are iOS simulator screenshots stored?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:24

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

Previous 1 ... 3 4 5 6 7 ... 10 Next
Advertisements