- 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

540 Views
To replace a character in objective C we will have to use the inbuilt function of Objective C string library, which replaces occurrence of a string with some other string that we want to replace it with.To create a string in objective C we need to write −NSString *str = @"tutori@als";Now we have a choice of replacing characters in this string and creating new one, or modify this same string. In this example we will modify this string and print in the next line.str = [str stringByReplacingOccurrencesOfString:@"@" withString:@""]; NSLog(@”%@”, str);When we run the above code, str is replaced with “tutorials” ... Read More

6K+ Views
To 1 day to a date in swift we need to create a date first. Once that date is created we have to add specific days to it. In this example we’ll see how we can achieve the same.Let’s create a date first, let it be today, let today = Date()Now to modify this date we’ll use the add function with negative value, let modifiedDate = Calendar.current.date(byAdding: .day, value: 1, to: today)!Now to see the difference between both the dates, let’s add print statement for both of these. Our complete code should now look like this.let today = Date() print(today) ... Read More

2K+ Views
To download a video from a URL in swift we need to perform a few steps while keeping a few things in mind.Points to be noted here are, We’ll be making use of internet to download video, hence we need to allow permissions for App transport security in our Info.plistWe’ll need to save the downloaded video to Photos app, hence photos permission is required.Video should always be downloaded in background as it may prevent us from using the app if downloaded on foreground.Now, we’ll use the below code to save a video from a random link in our Device. You’ll ... Read More

440 Views
To add a live camera preview to our default UIView in swift we can either use AVFoundation framework of iOS SDK or native UIImagePickerController(). In this example we’ll be using ImagePicker as our aim is to present camera preview on the UIView and Imagepicker is suitable for that task. AVFoundation can be used when we need a lot of customization on our camera or different types of custom actions.To show a camera preview on the UIView we need to perform the following steps.Create a UIImagePickerController object.Conform our class to UIImagePickerControllerDelegate and UINavigationControllerDelegate.Assign delegates to the object we created in step ... Read More

219 Views
Bitcode – Bitcode is an intermediate reperesentation of how the code looks. This code can not be used by us or can’t be installed on a device. When we upload our application to the app store It is uploaded as an bitcode and later converted to app binary by itunes/Apple.When the Intermediate code is created an uploaded to the App store or run on the device, a program called LLMV takes over the control and converts the Intermediate code to a Binary file which is x86 32Bit or x86 64 bit for the simulator and ARM for the actual iOS handheld ... Read More

87 Views
When we build an iOS application, by default it get a version 1.0 and build 0. Whenever we upload a new build to the app store, we need to change the version number. We can update the build number for testing builds. The version and build number are stored in the info.plist file in our project.Sometimes we might need to access the build or the version number in our application to perform some custom action.To get the version number we can use the following code and assign it to a variable or constant.Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! StringTo get the build number ... Read More

2K+ Views
To detect current device with iOS/Swift we can use UserInterfaceIdiom. It is an enum in swift, which tells which device is being used.The interface idiom provides multiple values in it’s enum which are.case unspecified @available(iOS 3.2, *) case phone // iPhone and iPod touch style UI @available(iOS 3.2, *) case pad // iPad style UI @available(iOS 9.0, *) case tv // Apple TV style UI @available(iOS 9.0, *) case carPlay // CarPlay style UIIn swift interfaceIdiom can be used in the following way:print(UIDevice.current.userInterfaceIdiom) if UIDevice.current.userInterfaceIdiom == .phone { print("running on iPhone") }When we run the above code ... Read More

4K+ Views
To navigate from one view Controller to another view Controller in iOS, we need to use Navigation controller. Navigation controller manages a stack of View controller when we go from one view to another view.Navigation from one view controller to another view controller can be done like mentioned below.Step 1 − Create a View controller object.let vc = self.storyboard?.instantiateViewController(withIdentifier: "VC2ViewController") as! VC2ViewControllerIn this step we initialize an object of the type of our another view controller, to which we want to navigate. The identifier variable should be same as the identifier of our second view controller.Step 2 − Navigating to ... Read More

886 Views
To validate email and phone in swift language we can use multiple conditional statements like if conditions, but that’s a long process and may contain 50-100s of if statements to validate email.So instead of conditionals we’ll use Regular expression. Swift provides NSPredicates which we can use to evaluate a regular expression and test them.Let’s see how we can use regular expressions to do the same.We’ll create a function which we can use as extension of String class or UIViewController to use through out the project.Add the following code to any class in your Project, or create a separate swift class ... Read More

3K+ Views
To use a Bold and a regular/Non-Bold text in a single UILabel, we can either use a storyboard editor to achieve the same, or we can do it programmatically. Let’s see both of them.Method One − Editing with StoryboardSelect the label you want to edit, go to it’s attribute inspector.From the first option Text, select Attributes instead of plain.Write the following text in the label “Bold Regular”Double Click on Bold to select it, and then right click on it to see more options.Select font > Bold from that option. It should do the task.Method Two − Programmatically Achieving the result.Add the ... Read More