Mohtashim M

Mohtashim M

28 Articles Published

Articles by Mohtashim M

Page 3 of 3

How to use both front and back cameras simultaneously in iOS?

Mohtashim M
Mohtashim M
Updated on 07-Aug-2019 323 Views

As of now, there’s no way you can access both front and back cameras simultaneously. As both cameras have different session, as soon as one will start other session will die.As per the apple developer forum answered by Apple support team −“Apps cannot capture from the front and back cameras simultaneously. You can switch from one to the other (with a short delay between) but not both at the same time”

Read More

How do I create a TableView with rounded corners in iOS?

Mohtashim M
Mohtashim M
Updated on 07-Aug-2019 2K+ Views

Table View is one of the most important and fundamental part of iOS application, Every iOS developer should be familiar with it.Almost every application you see in App store use table view.Table views on iOS display a single column of vertically scrolling content, divided into rows. Each row in the table contains one piece of your app’s content. For example, the Contacts app displays the name of each contact in a separate row, and the main page of the Settings app displays the available groups of settingsYou can read more about table view here,  https://developer.apple.com/documentation/uikit/uitableviewIn this post we will see ...

Read More

How to detect user pressing HOME key in iOS?

Mohtashim M
Mohtashim M
Updated on 07-Aug-2019 388 Views

It is very important to know when user is pressing home key as it puts the application to background, here we will be seeing how to identify or get a call when user presses home key.In you AppDelegate.swift, there are delegates methods.Open your AppDelegate.swift and in applicationWillResignActive(_ application: UIApplication) and applicationDidEnterBackground(_ application: UIApplication), write print statement and put a breakpoint as shown.Run the application, once the app is launch tap the home button, applicationWillResignActive will be called and then applicationDidEnterBackground.

Read More

How to enable/disable data connection in iOS programmatically?

Mohtashim M
Mohtashim M
Updated on 30-Jul-2019 497 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.

Read More

Set Border for an ImageView in iOS?

Mohtashim M
Mohtashim M
Updated on 30-Jul-2019 1K+ 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

Where and how to use static variable in swift?

Mohtashim M
Mohtashim M
Updated on 30-Jul-2019 8K+ 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

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

Mohtashim M
Mohtashim M
Updated on 30-Jul-2019 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

How do I prevent an iOS device from going to sleep mode?

Mohtashim M
Mohtashim M
Updated on 30-Jul-2019 1K+ Views

When most apps have no touches as user input for a short period, the system puts the device into a "sleep” state where the screen dims. This is done for the purposes of conserving power.Preventing iOS Device from going to sleep is easy, navigate to your Settings → Display & Brightness → Autolock, select never.This will never lock your screen.If you’re developing an iOS Application and you’re required to implement this feature, you should use isidletimerdisabled provided by apple, to read more about it https://developer.apple.com/documentation/uikit/uiapplication/1623070-isidletimerdisabledIn your viewDidLoad method write the following line of code to prevent the device from going to ...

Read More
Showing 21–28 of 28 articles
« Prev 1 2 3 Next »
Advertisements