Found 2041 Articles for Mobile Development

How to add line break for UILabel in iOS/iPhone?

George John
Updated on 29-Jun-2020 13:52:56

2K+ Views

Line break in a UILabel is used to change how the text appears on a label. Suppose a label has text more than two lines but by default the Line break in a UILabel is used to change how the text appears on a label. Suppose a label has text more than two lines but by default the label shows 1 line and wraps/ trims the text that’s more than the label size.This can be done in multiple ways. Three of them are mentioned below.On the storyboard add a label.Give top constraint, trailing and leading constraint.Method One − Editing with ... Read More

How to create NSIndexPath for TableView in iOS?

Chandu yadav
Updated on 30-Jul-2019 22:30:24

727 Views

Index path is generally a set of two values representing row and section of a table view. Index path can be created in objective C as well as Swift as both are native language of iOS Development.IndexPathForRow is a class method in iOS. To create a index path we need to be sure about the section and row we need to create. Below are the methods of creating an Indexpath.To create an IndexPath in objective C we can use.NSIndexPath *myIP = [NSIndexPath indexPathForRow: Int inSection:Int] ;ExampleNSIndexPath *myIP = [NSIndexPath indexPathForRow: 5 inSection: 2] ;To create an IndexPath in Swift we ... Read More

How to renew distribution certificate for iOS?

Arjun Thakur
Updated on 30-Jul-2019 22:30:24

819 Views

To renew a distribution certificate on mac we’ll have to go through a series of steps mentioned below.Use spotlight to open keychain access on your macFrom keychain access menu select Certificate Assistant -> Request certificate from certificate Authority.Fill the information there like Name, email and choose “save to disk”.Click continue and save to your desired location. This will generate a .CSR file which we’ll need to upload to the developer portal while generating our certificate.Go to “developer.apple.com”, login to your account, select “Certificates, IDs & Profiles”.Go to certificates, select production and click on the “+” on the topSelect "App Store ... Read More

How to use the front camera in Swift?

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

837 Views

To use the front camera in swift we first need to get a list of cameras available in the device we are using. In this article we’ll see how to get the list of devices and then check if the front camera is available or not. We’ll do it in a series of steps.Import AVFoundationCheck if the list of cameras existsFilter out the front camera if exists.guard let frontCamera = AVCaptureDevice.devices().filter({ $0.position == .front }) .first as? AVCaptureDevice else { fatalError("Front camera not found") }The devices() method of AVCapture returns the list of cameras available. From that ... Read More

Lazy loading of images in table view using Swift

George John
Updated on 30-Jul-2019 22:30:24

957 Views

To load an image in table view cell we’ll go through a series of steps.Create a table view, table view cell and add an Image view to it.Assign a custom class to the cell we created.In the cell for row at method write the following lines of code.let cell = tblView.dequeueReusableCell(withIdentifier: "CustomCell") as! CustomCell return cellTo download the image we’ll create a function and embed that into an extension.func setImageFromUrl(ImageURL :String) {    URLSession.shared.dataTask( with: NSURL(string:ImageURL)! as URL, completionHandler: {       (data, response, error) -> Void in       DispatchQueue.main.async {          if let ... Read More

How to convert ArrayList to String using GSON?

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

2K+ Views

GSON is java library, It is used to convert OBJECT to JSON and JSON to Object. Internally it going to work based on serialization and de- serialization.This example demonstrate about how to convert ArrayList to string using GSON library.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code in build.gradle.apply plugin: 'com.android.application' android {    compileSdkVersion 28    defaultConfig {       applicationId "com.example.andy.myapplication"       minSdkVersion 15       targetSdkVersion 28       ... Read More

How to save ArrayList to SharedPreferences on Android?

Nancy Den
Updated on 27-Jun-2020 13:43:48

4K+ Views

Before getting into shared preference to store arraylist example , we should know what is shared preferences in android. Using share preference, we can store or retrieve values as key and value pair. There are five different methods are available in share preference as shown below −Edit() − It going to edit shared preference valuescommit() − it going to commit shared preference values in xml fileapply() − It going to commit back changes from editor to shared preference.remove(String key) − It going to remove key and vales from shared preference use key.Put() − It going to put key and values ... Read More

How to explain Android Shared preferences with example?

Nishtha Thakur
Updated on 27-Jun-2020 07:31:58

274 Views

Using share preference, we can store or retrieve values as key and value pair. There are five different methods are available in share preference as shown below −Edit() − It going to edit shared preference valuescommit() − it going to commit shared preference values in xml fileapply() − It going to commit back changes from editor to shared preference.remove(String key) − It going to remove key and vales from shared preference use key.Put() − It going to put key and values to shared preference xml.A sample example syntax of shared preference as shown below −final SharedPreferences sharedPreferences = getSharedPreferences("USER", MODE_PRIVATE);In ... Read More

Corona vs. Phonegap vs. Titanium

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

135 Views

In this article we’ll learn about Corona, PhoneGap and Titanium, though all these technologies are different, the common thing between these is that they all are cross platform. i.e they can be used to write program once and then run that on multiple platforms like iPhones and android devices.Corona − Corona is a free and open source SDK (Software development kit), developed by corona Labs roughly 10 years ago in 2009. Corona is mainly for developing 2D mobile applications for most of the platforms including iOS, Android, Desktop/ Windows Applications. Corona is based on top of C++ and openGL to ... Read More

How to hide Back Button on navigation bar on iPhone/iPad?

Nishtha Thakur
Updated on 27-Jun-2020 13:17:29

4K+ Views

To hide the back button on navigation bar we’ll have to either set the navigation button as nil and then hide it or hide it directly.Let’s create a project, add 2 view controller and Embed them in navigation controller. Let’s see how this project looks when run without any code to remove the navigation bar.This code set’s the navigation bar’s back button as hidden.self.navigationController?.navigationItem.hidesBackButton = trueThis code set’s the navigation bar’s back button as nilself.navigationItem.leftBarButtonItem = nil;A combination of these to approaches would be a better solution and works even if you have set a custom navigation bar.self.navigationItem.leftBarButtonItem = nil ... Read More

Advertisements