On click Button Call
<***********Steps to create calling Button**********>
Add pies of code in info.plist
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>telprompt</string>
<string>tel</string>
</array>
</dict>- Add Button in Storyboard
Create An Button Action in View Controller
@IBAction func call(sender: AnyObject) {//Replace with your Phone NumberUIApplication.sharedApplication().openURL(NSURL(string: "tel://1234567890")!)}<*******OR********>
<***********Steps to create calling Button with function**********>
Add pies of code in info.plist
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>telprompt</string>
<string>tel</string>
</array>
</dict>- Add Button in Storyboard
Create An Button Action in View Controller with callPhoneNumber Method.
@IBAction func call(sender: AnyObject) {//Replace with your Phone Number
callPhoneNumber("1234567890")}Create Function with name callPhoneNumber()
private func callPhoneNumber(phoneNumber:String) {
if let phoneCallURL:NSURL = NSURL(string: "tel://8050741946") {
let application:UIApplication = UIApplication.sharedApplication()
if (application.canOpenURL(phoneCallURL)) {
application.openURL(phoneCallURL);
}
}
}
Finished Run and Check ......happy Coding
Thursday, 14 July 2016
Onclick Button calling with PhoneNumber in ios swift2
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment