Found 208 Articles for IOS

Set up a simple delegate to communicate between two view controllers in iPhone

Anvi Jain
Updated on 27-Jun-2020 13:35:40

572 Views

In this article, you learn about delegates and creating delegates. First of all, What’s a delegate?Delegate is a simple term that refers to communication between objects. It is a simple way of connecting objects and communication between them.How does delegate work?A delegate is created with help of protocol. A protocol is declared in class, inside which some event will happen, that should notify other classes. In protocol we write the declaration of function and it is defined inside the calling class.How to create a delegate?We’ll do this with help of an example project.Steps to perform −Create a class, name it ... Read More

How to detect the screen size of iPhone 5?

Jennifer Nicholas
Updated on 27-Jun-2020 13:39:48

157 Views

Detecting screen size of an apple device is an easy and simple task. The UIKIT module of iOS SDK provides many functions and classes that deal with user interface, screen sizes and many other UI elements.One of them is UIScreen which deals with the device screen.UIScreen.main provides the current main screen of the device in use, which further has methods that return other features and properties of the current screen.To find if the current screen is an iPhone 5 or not, we’ll first have to find the current size of the screen and compare with a value. The height of ... Read More

How to determine the current iPhone model information?

Nitya Raut
Updated on 27-Jun-2020 13:40:26

285 Views

iOS Provides a UIDevice class which has all the information about your iPhone that does not violate any privacy laws Apple has.Using the UIDevice we can access information like −UIDevice.current.localizedModel − this returns the localized version of modelUIDevice.current.model − this returns model of current device, e.g. @"iPhone", @"iPod touch"UIDevice.current.name − this returns the current name of the device in use, e.g. "My iPhone"UIDevice.current.systemName − this returns the system name e.g. @"iOS"UIDevice.current.systemVersion − this returns the system version e.g. @"4.0"UIDevice.current.batteryLevel − this returns the battery level, if it is between 0 to 1, it will return the value otherwise if the ... Read More

How can I develop for iPhone using a Windows development machine?

Anvi Jain
Updated on 27-Jun-2020 13:41:25

66 Views

Generally iOS applications can be developed on mac operating systems only, but recently with system development now applications for iOS can partially be developed on windows system too.To develop iOS or any other apps for apple platform, we need Xcode which is a native Apple software and can be installed on mac operating systems only. Also, a mac operating system is generally installed and supported on an Apple device.There are multiple work around for this like buying a normal laptop installing third party software to run mac OS on them and later installing Xcode, or buying/renting a cloud Mac. In ... Read More

How to store custom objects in NSUserDefaults?

Vrundesha Joshi
Updated on 27-Jun-2020 13:44:37

459 Views

In this article we’ll learn how to store custom objects in our application, but before you learn how to store custom object let’s see what are custom object?A custom object is any class or structure or any other data that is not a native data type like Int, Double, String etc. Storing data in NSUserDefaults is a three step process.Creating the custom ObjectWe’ll create a custom class Person that will have an age variable, and name variable.class Person: NSObject, NSCoding {    var name: String    var age: Int    init(name: String, age: Int) {       self.name = ... Read More

How to add Exception Breakpoint in Xcode?

Jennifer Nicholas
Updated on 27-Jun-2020 13:45:24

1K+ Views

Sometimes while writing an iOS application or any other application we need to test multiple cases and debug the application of any known and unknown bugs. There are certain places in the code where we want our app to stop so that we can know the values of certain variables at the point and fix that bug. Before we learn how to add a break point, first let’s seeWhat’s a break point?A break point is a place in our code where the app pauses on a certain event. A break point may be added manually in xcode or may be ... Read More

How to determine device type (iPhone, iPod Touch) with Swift?

Nitya Raut
Updated on 27-Jun-2020 13:47:26

563 Views

When working on iOS applications, we sometimes need to know the device on which application is installed, and provide custom features depending on the device in use. For example, we want to provide some features on iPhone X but not on iPhone 7. In this article we’ll learn how to find the iOS device being used, using an iOS Application.Let’s go through some terms that will be required for achieving the desired results, utsname − this is a structure located in Darwin module of iOSuname − uname is a function that takes utsname as an input and returns Int32 as ... Read More

How to determine device type (iPhone, iPod Touch) with iPhone SDK?

Anvi Jain
Updated on 27-Jun-2020 13:47:59

309 Views

When working on iOS applications, we sometimes need to know the device on which application is installed, and provide custom features depending on the device in use. For example, we want to provide some features on iPhone X but not on iPhone 7. In this article, we’ll learn how to find the iOS device being used, using an iOS Application.Let’s go through some terms that will be required for achieving the desired results, utsname − this is a structure located in Darwin module of iOSuname − uname is a function that takes utsname as an input and returns Int32 as ... Read More

Advertisements