Found 208 Articles for IOS

How to count number of characters in Text box while typing in iOS?

Mohtashim M
Updated on 30-Jul-2019 22:30:26

1K+ Views

As an iOS developer one should know how to manipulate with text field and it’s operation, Apple has already provided UITextFieldDelegate protocol.To read more about it https://developer.apple.com/documentation/uikit/uitextfielddelegateYou may have seen may application where forms are involved, and you see number of characters you’re entering when you type specially on the forms where characters are restricted to certain count.In this post we’re going to see the same how to display the character count, when you type in TextField.Step 1 − Open Xcode → New Project → Single View Application → Let’s name it “TextFieldCount”Step 2 − Open Main.storyboard and add TextField and ... Read More

Where and how to use static variable in swift?

Mohtashim M
Updated on 30-Jul-2019 22:30:26

7K+ Views

Before we see where and how to use static variable, let us first understand, What is static variable in swift?Static VariableStatic variables are those variables whose values are shared among all the instance or object of a class. When we define any variable as static, it gets attached to a class rather than an object. The memory for the static variable will be allocation during the class loading time.Let us understand above figure, we have a class Sample and it has two object s1 and s2. You see s1 and s2 both have their variable “a” separately but they have ... Read More

Set Border for an ImageView in iOS?

Mohtashim M
Updated on 30-Jul-2019 22:30:26

944 Views

Setting border for image view is easy, In this post we will see how to set Border for an Image View in iOS.Let’s get started.Step 1 − Open Xcode → New Project → Single View Application → Let’s name it “BorderToImage”We will create an image view and a button in our storyboard on tap of button we will add border to image view. We could do the same in viewDidLoad but to see the difference we’re doing this.Step 2 − In Main.storyboard add an image view and a button as shown below.Step 3 − Create @IBOutlet for image and name ... Read More

How to enable/disable data connection in iOS programmatically?

Mohtashim M
Updated on 30-Jul-2019 22:30:26

268 Views

User can turn on or turn off mobile data from settings of an iOS device, but it’s practically not possible to disable or enable the same programmatically. It is only possible if you jailbroke an iOS device.. Apple does not allow any apps developer to access wifi or Bluetooth.There are some private API’s which may aid this but eventually result in app rejection from the app store.

How to play audio and video file in iOS?

Mohtashim M
Updated on 30-Jul-2019 22:30:26

812 Views

Understanding how to play audio and video in iOS is very important, as almost every application has audio and video these days. From your gaming application to social media to your music player and so on.In this post, we will be seeing how to play audio and video file using Swift.So let’s get started.Step 1 − Open Xcode → New Project → Single View Application → Let’s name it “AudioVideo”.Step 2 − Open Main.storyboard and add three buttons and name them as shown below.Step 3 − Create @IBOutlet for three buttons and name it to stop, playButton and video button, ... Read More

How to get the current location latitude and longitude in iOS?

Kumar Varma
Updated on 30-Jul-2019 22:30:26

2K+ Views

Almost all the application uses location services, thus having complete understanding on location is necessary. In this post we will be seeing how to get current location’s latitude and longitude.For this we will be using CLLocationManager, you can read more about it herehttps://developer.apple.com/documentation/corelocation/cllocationmanagerWe will be developing a sample application where we will print user’s latitude and longitude on viewDidLoad method, alternatively you can print on tap of a button also on UILabel as per need.So let’s get started, Step 1 − Open Xcode → New Projecr → Single View Application → Let’s name it “Location”Step 2 − Open info.plist file ... Read More

How can I set an icon for my iOS application?

Kumar Varma
Updated on 30-Jul-2019 22:30:26

114 Views

Every app needs a beautiful and memorable icon that attracts attention in the App Store and stands out on the Home screen. Your icon is the first opportunity to communicate, at a glance, your app’s purpose. It also appears throughout the system, such as in Settings and search results.Here we will be seeing how we can set icon for iOS Application but before that we should make sure and understand that Every app must supply small icons for use on the Home screen and throughout the system once your app is installed, as well as a larger icon for display ... Read More

How do I display the current date and time in an iOS application?

Rama Giri
Updated on 30-Jul-2019 22:30:26

206 Views

Playing with date and time is very important in any programming language, it becomes more important if you’re developing mobile application.Numerous application such as weather, forecast, gaming and so on uses date and time. In this we will be seeing how we can get the current date and time.To get the current date and time we will be using timeIntervalSince1970 instance property, you can read about it https://developer.apple.com/documentation/foundation/nsdate/1407504-timeintervalsince1970So copy the below code in your viewDidLoad method and run the application, we will be printing the current date and time, and based on requirement we can print the same in UILabel ... Read More

How to set background color of a View in iOS App?

Kumar Varma
Updated on 30-Jul-2019 22:30:26

2K+ Views

Views are the fundamental building blocks of your app's user interface, and the  UIView class defines the behaviors that are common to all views. A view object renders content within its bounds rectangle and handles any interactions with that content. The  UIView class is a concrete class that you can instantiate and use to display a fixed background color.It is very important to have complete understanding of UIView as they are the main object user sees.Here we will be seeing how to change the background color of view programmatically and via storyboard.First let us see using storyboard, Open Main.storyboard and ... Read More

How to Set opacity for View in iOS?

Rama Giri
Updated on 30-Jul-2019 22:30:26

1K+ Views

View’s Alpha value is a floating-point number in the range 0.0 to 1.0, where 0.0 represents totally transparent and 1.0 represents totally opaque. Changing the value of this property updates the alpha value of the current view only.You can simply adjust alpha value based on the opacity you want.Write the following line in you viewDidLoad methodview.backgroundColor = UIColor(white: 1, alpha: 0.5)Run the application, the view’s opacity you can see is 50%

Previous 1 ... 6 7 8 9 10 ... 21 Next
Advertisements