objective c - iBeacon to push another view! iOS App -
what trying make when ibeacon has been found (when user on home screen), sends them part of app. pushes view of app storyboard. example, ibeacon1 pushes view1, ibeacon2 pushes view2, etc, , that's it. said know possible, because ibeacons quite new, there isn't available.
i appreciate if take time out of day me issue cannot find answer to.
thank time, josh
if using storyboards, in appdelegate
:
var launchedviewcontrollers = [int]() func locationmanager(manager: cllocationmanager, didrangebeacons beacons: [clbeacon], inregion region: clbeaconregion) { let mainstoryboard: uistoryboard = uistoryboard(name: "main", bundle: nil) if let navcontroller = self.window?.rootviewcontroller?.navigationcontroller { beacon in beacons { if (beacon.minor == 1) { if !launchedviewcontrollers.contains(beacon.minor.integervalue) { launchedviewcontrollers.append(beacon.minor.integervalue) let viewcontroller1 = mainstoryboard.instantiateviewcontrollerwithidentifier("viewcontroller1") navcontroller.pushviewcontroller(viewcontroller1, animated: true) } } if (beacon.minor == 2) { if !launchedviewcontrollers.contains(beacon.minor.integervalue) { launchedviewcontrollers.append(beacon.minor.integervalue) let viewcontroller2 = mainstoryboard.instantiateviewcontrollerwithidentifier("viewcontroller1") navcontroller.pushviewcontroller(viewcontroller2, animated: true) } } } } }
you rewrite use segues instead of programmatically pushing viewcontrollers
using navigationcontroller
both work.
Comments
Post a Comment