Skip to main content

Posts

Showing posts from October, 2017

Set multiple markers and image on google map swift 3

  let locations = [                     [ "title" : "Phase 11, Mohali" , "latitude" : 30.680177 , "longitude" : 76.745705 ],                     [ "title" : "Phase 6, Mohali" , "latitude" : 30.735547 , "longitude" : 76.712071 ],                     [ "title" : "Phase 106, Mohali" , "latitude" : 30.728100 , "longitude" : 76.717665 ]                 ]                          for location in locations {                     let marker = GMSMarker()                     marker.position = CLLocationCoordinate2D(latitude: location[ "latitude" ] as ! Double, longitude: location[ "longitude" ] as ! Double )   ...

post notification in ios

// Send Notification from you want. [[ NSNotificationCenter defaultCenter ] postNotificationName :@ "MyNotification" object : self ]; // Receive Notification in other class. Where want to receive it. [[ NSNotificationCenter defaultCenter ] addObserver : self selector : @selector (myMethod :) name :@ "MyNotification" object : nil ]; // Create method - ( void ) myMethod:( NSNotification *) notification { // Your Code here, Which you want to perform. } Happy Coding :)

How to Async Image download in swift 3

//Make a method by extension of class //create any where extension UIImageView {     func downloadedFrom(url: URL , contentMode mode: UIViewContentMode = . scaleAspectFit ) {         contentMode = mode         URLSession . shared . dataTask (with: url) { data, response, error in             guard                 let httpURLResponse = response as ? HTTPURLResponse , httpURLResponse. statusCode == 200 ,                 let mimeType = response?. mimeType , mimeType. hasPrefix ( "image" ),                 let data = data, error == nil ,                 let image = UIImage (data: data)                 else { return }             DispatchQueue . main ....

Set multiple pins on MapKit view swift 3

//Using lat-long array we can eaisly set multiple pin over map. let locations = [ [ "title" : "New York, NY" , "latitude" : 40.713054 , "longitude" : -74 . 007228 ], [ "title" : "Los Angeles, CA" , "latitude" : 34.052238 , "longitude" : -118 . 243344 ], [ "title" : "Chicago, IL" , "latitude" : 41.883229 , "longitude" : -87 . 632398 ] ] for location in locations { let annotation = MKPointAnnotation () annotation . title = location [ "title" ] as ? String annotation . coordinate = CLLocationCoordinate2D ( latitude : location [ "latitude" ] as ! Double , longitude : location [ "longitude" ] as ! Double ) mapView . addAnnotation ( annotation ) } Happy Coding :)

Add Button on UItextField in swift 3

     var hideShowbtn = UIButton () hideShowbtn = UIButton (type: . custom )         hideShowbtn . setImage ( UIImage (named: "HIdeShowImg" ), for: . normal )         hideShowbtn . frame = CGRect (x: CGFloat ( self . passwordTF . frame . size . width - 25 ), y: CGFloat ( 0 ), width: CGFloat ( 25 ), height: CGFloat ( 25 ))         hideShowbtn . addTarget ( self , action: #selector ( self . refresh ), for: . touchUpInside )         self . passwordTF . rightView = hideShowbtn          self . passwordTF . rightViewMode = . always Happy Coding :)

Open Camera and Gallery In Swift 3

//Define this in your button action.   @IBAction func profileBtnAct( _ sender: Any )     {         //Create the AlertController and add Its action like button in Actionsheet         let actionSheetControllerIOS8: UIAlertController = UIAlertController (title: "Select Image" , message: nil , preferredStyle: . actionSheet )                  let cancelActionButton = UIAlertAction (title: "Camera" , style: . default ) { _ in             print ( "Camera" )             self . openCamera ()         }         actionSheetControllerIOS8. addAction (cancelActionButton)                  let saveActionButton = UIAlertAction (title: "Gallery" , style: . default )         { _ in       ...

Paystack payment method/function in objective-c

  PSTCKCardParams *cardParams = [ _paymentTextField cardParams ];          //     //When we create custom textfields     //     PSTCKCardParams *cardParams = [[PSTCKCardParams alloc] init];     //     // then set parameters thus from card     //     cardParams.number= self.TFout.text;          PSTCKTransactionParams *transactionParams = [[ PSTCKTransactionParams alloc ] init ];     transactionParams. amount =[[ _planAry valueForKey : @"plan_price" ] intValue ];     transactionParams. email =[[ NSUserDefaults standardUserDefaults ] valueForKey : @"userEmailID" ];          //transactionParams.subaccount     UIViewController *vc = self . view . window . rootViewController ;     //[self presentViewController: activityController animated: YES completion:nil];  ...