- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 98 Articles for IPhone/iPad

1K+ 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

393 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

284 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

92 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

366 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

585 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

1K+ Views
To add a UISegmentControl in iOS with swift we’ll have to first create a segment control and it’s controller function, i.e. it’s action. Let’s see those steps.Let’s create a function to add a segmented control.func addControl() { let segmentItems = ["First", "Second"] let control = UISegmentedControl(items: segmentItems) control.frame = CGRect(x: 10, y: 250, width: (self.view.frame.width - 20), height: 50) control.addTarget(self, action: #selector(segmentControl(_:)), for: .valueChanged) control.selectedSegmentIndex = 1 view.addSubview(control) }This function may be called in our view controller to add the segmented control, let’s add action for ... Read More

3K+ Views
To change the background color of a button in iOS application we need to access the property ‘ backgroundColor’ of the UIButton. We can do this in two ways, programmatically and using the storyboard.Method 1 − Using the storyboard editorAdd a button on your storyboard, select it Go to it’s attribute inspector and select 'Background' property to choose the color.Method 2 − Programmatically changing the backgroundCreate outlet of the button on the View Controller.In the viewDidLoad() or viewWillLayoutSubview() method add the code to change the background color.btn.backgroundColor = #colorLiteral(red: 0.4392156899, green: 0.01176470611, blue: 0.1921568662, alpha: 1)When we run the method ... Read More

387 Views
In this article we’ll see how to open a pdf file using swift in iOS. Here we’ll do it with an example of opening pdf in webView in iOS. Let’s create a project and add WKWebView to the storyboard.Connect it’s outlet to the ViewController class.Now we’ll see two different thingsOpening a PDF file from a URL on the web.To open a web view from a url, first we need to have a url with a pdf file. In this example I’ll be using a dummy URL https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdfLet’s create a URL first, let url: URL! = URL(string: "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf")Now the remaining steps ... Read More

1K+ Views
To make an iPhone vibrate using swift we’ll use two different methods. First create a new project and add Four different buttons to the main View controller.Now import the AudioToolbox framework in your view controller class.For the first button add an action and write the following code as shown below:@IBAction func actionButtonOne(_ sender: Any) { AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate)) }This will generate a long vibrating feedback on your device. Now to create more vibration effects on devices with iOS 10 or more we’ll add methods for all four different buttons.@IBAction func actionButtonTwo(_ sender: Any) { let generator = UIImpactFeedbackGenerator(style: .heavy) ... Read More