Found 2041 Articles for Mobile Development

How to create a WebView in iOS/iPhone?

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

445 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

440 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

106 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

124 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

How to use images while developing iOS App in a Simulator?

Rishi Rathor
Updated on 30-Jun-2020 05:25:46

2K+ Views

Sometimes we need to test our iOS app with multiple cases and we may not have physical device all the time. For example if we need to see if image upload is working correctly but we do not have an actual iPhone then we may need to add more images to the simulator and test from there. Adding images to simulator is an easy task and can be done in a few different ways. Some of them are mentioned below.Method 1Open Simulator appSelect the image you want to addDrag and drop it in the simulatorIt will be added to the ... Read More

How To Change UIView's Border Color And Thickness in Cocoa Touch?

Jennifer Nicholas
Updated on 30-Jun-2020 05:13:43

500 Views

In this article we'll learn how to change a View's border color and thickness.This can be done in two ways as mentioned below.Method 1 − Writing the codeLet's suppose we have a view name backView, then to add a border color and thickness we can writebackView.layer.borderWidth = 5 // Or any integer valuebackView.layer.bordercolor = colorLiteral(red: 0.09019608051, green: 0, blue: 0.3019607961, alpha: 1) this code will add a border of 5 width and a dark blue color. Below is the output is produces.Method 2 − Creating an extension of UIView with designable and inspectable@IBDesignable class DesignableView: UIView { } extension UIView ... Read More

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

Anvi Jain
Updated on 30-Jul-2019 22:30:24

419 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

How to create a left-arrow button on a Toolbar on iPhone/iPad?

Vrundesha Joshi
Updated on 30-Jun-2020 05:16:57

142 Views

To create a button on toolbar we'll need to use two different components of iOS and another image that is a back arrow. Before that let's see what those components areToolbar − Toolbar is a native iOS component that is used to display items or toolbar on the bottom of screen.Bar Button item − It is a button that's usually created on a Toolbar or a navigation bar.When a toolbar is created using storyboard, it comes with a Bar button item.Let's start by creating a new project, in the main.storyboard give some background color to the only viewController we have.From ... Read More

Advertisements