Setting dateStyle or timeStyle will override any custom dateFormat you have set. Your date string does not conform in any way to NSDateFormatterShortStyle, which is why you are getting nil when trying to convert strings to dates. Furthermore, according to Unicode Technical Standard #35 revision 31, the timezone specifier of...
The Range is not an NSRange, but a Swift range. In this case, you can pass nil to represent the entire String: string = string.stringByReplacingOccurrencesOfString(swearWordPair[0], withString: swearWordPair[1], options: .CaseInsensitiveSearch, range: nil) If you wanted to limit the range, you can create a Range<String.Index> like this: var string = "I laid...
I have created a new extension to output the offset components as string for you: import UIKit extension NSDate { func yearsFrom(date:NSDate) -> Int{ return NSCalendar.currentCalendar().components(.CalendarUnitYear, fromDate: date, toDate: self, options: nil).year } func monthsFrom(date:NSDate) -> Int{ return NSCalendar.currentCalendar().components(.CalendarUnitMonth, fromDate: date, toDate: self, options: nil).month } func weeksFrom(date:NSDate) -> Int{...
ios,swift,cllocationmanager,ibeacon
You can use the locationManager:didDetermineState:forRegion: callback, which tells you if you are either Inside, Outside or Unknown. You can force yourself to get a callback by calling locationManager.requestStateForRegion(region) when your app starts up. See more here: https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManagerDelegate_Protocol/#//apple_ref/occ/intfm/CLLocationManagerDelegate/locationManager:didDetermineState:forRegion:...
ios,layout,uiscrollview,uinavigationcontroller,autolayout
Simply you add below code self.automaticallyAdjustsScrollViewInsets = NO; in - (void)viewDidLoad method...
I think your problem is that you are using a calendar with an unset time zone. Your calculation of adding 60*60*24*2 to the current time does not account for the two days when some timezones change to and from daylight savings time. Those days are 23 and 25 hours long....
You cant use same functions inside a single class. Instead you will need to identify each collection view somehow (by creating outlets or giving them a tag) and then in each function check the collectionview parameter and compare it with your collection views. Example : func collectionView(collectionView: UICollectionView, numberOfItemsInSection section:...
ios,objective-c,uitableview,core-data
I resolved this. Here is what was done. First off there was serious cleanup of files, arrangement, etc. There were some objects, attributes, etc., that didnt make sense. Renaming things helped a lot as I was causing a lot of confusion. There was a one-to-one relationship between my List and...
GADInterstitial delegate is a weak stored property, so you should create a stored property in your class: var adDelegate : AdDelegate? // to store the delegate func createInterstitial()->GADInterstitial { var interstitial = GADInterstitial() interstitial.adUnitID = "ca-app-pub-6938332798224330/6206234808"; adDelegate = AdDelegate() interstitial.delegate = adDelegate //delegate is weak so we need to store...
ios,xcode,xcode7,ios9,asset-catalog
I think its not possible to use Asset Catalog for video stuff, Its simplify management of images. Apple Documentation Use asset catalogs to simplify management of images that are used by your app as part of its user interface. An asset catalog can include: Image sets: Used for most types...
Your code looks fine, it looks like you accidentally placed a breakpoint in your code, see that blue-looking arrow to the left of the green-highlighted line? Do one of the following: Go ahead and right click that and click Delete Breakpoint Drag and drop that breakpoint into your view controller...
Seems to be no error in your code, Check that the arrays in plist has the same naming as in your code might be mistaken something with keys. You can check that by right-click on plist and Open-as then choose source code Like : objectForKey("name") called <key>name</key> objectForKey("image") called <key>image</key>...
You can simply use integer/modulo arithmetic int tensDigit=originalNumber / 10; int onesDigit=originalNumber % 10; ...
ios,objective-c,swift,google-drive-sdk,google-api-objc-client
Avoid using a synchronous for loop. The createFolder function should call back when it's complete; that callback should start the next loop iteration.
First of all, you have two main choices: use a imageView with a GIF or use a video for background with AVPlayer or MPMoviePlayerController. You can find a lot of example for both ways, here's a few: use a GIF for cool background video cover iOS In reply to your...
You turn off case sensitivity using an i inline flag in regex: (?i)https?:\\/.* See Foundation Framework Reference for more information on available regex features. (?ismwx-ismwx) Flag settings. Change the flag settings. Changes apply to the portion of the pattern following the setting. For example, (?i) changes to a case insensitive...
iOS 9 has made a small change to the handling of URL scheme. You must whitelist the url's that your app will call out to using the LSApplicationQueriesSchemes key in your Info.plist. Please see post here: http://awkwardhare.com/post/121196006730/quick-take-on-ios-9-url-scheme-changes The main conclusion is that: If you call the “canOpenURL” method on a...
If you want to disable the swipe gesture then I think are you want to do something like programatically change the image. For very simply disable the user interaction of carousel. If you using storyboard then simple remove checkmark of User Inreaction Enabled If you use by code then following...
javascript,python,ios,flask,twilio
Twilio developer evangelist here. Twilio Client uses WebRTC and falls back to Flash in order to make web browsers into phones. Unfortunately Safari on iOS supports neither WebRTC nor Flash so Twilio Client cannot work within any browser on iOS. It is possible to build an iOS application to use...
In initializeSettingsView() add nibView.setTranslatesAutoresizingMaskIntoConstraints(false). And then in viewDidload add the hight constraint to settingsView constraints.append(NSLayoutConstraint(item: settingsView, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1.0, constant: 90.0)) And you do not need to set the position of settingsView, since it will be layout at the right position based on...
ios,objective-c,swift,storyboard,segue
What the show (e.g. Push) segue does internally is to call -[UIViewController showViewController:sender:] Calling this method on your view controller itself, will trigger the appropriate way of presenting the view controller you are passing. // Swift self.showViewController(viewControllerToShow, sender: self) // Objective-C [self showViewController: viewControllerToShow sender: self]; The animation can be...
You need to use UITextField instead of UILabel. When you insert a new cell, set this UITextField's enabled property to true. When loading all the other cells remember to set it to false to disable editing (the same cell maybe used at more than one place)....
ios,swift,uitableview,uiviewcontroller
You just need to add this to your code in viewDidLoad. self.tableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero]; EDIT: sorry i was written in objective -c here is in swift. self.tableView.tableFooterView = UIView(frame:CGRectZero) The tableview will display what appear to be extra blank rows to fill out the bounds if there are not...
ios,objective-c,camera,avcapturedevice,avcapture
this code is returns an AVCaptureDevice instance for the default device of the given media type. AVCaptureDevice *inputDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; change this code to .... AVCaptureDevice *inputDevice = nil; NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]; for(AVCaptureDevice *camera in devices) { if([camera position] == AVCaptureDevicePositionFront) { // is front camera inputDevice...
Found a hack !! :( you should write this line before setting up the text, [btnTermOfUse titleLabel].numberOfLines = 0; This will show you the line on device too....
ios,objective-c,uipopovercontroller
You have to set the delegate of your AssistanceNeededAtPopOverViewController that pops the controllerview, as the new GlobalPageSideDetailViewController. Here you're setting the delegate of a controller you just instantiate and not the one which poped the controller. ...
var dateFormatter = NSDateFormatter() dateFormatter.dateFormat = "yyyy-MM-dd" dateFormatter.locale = NSLocale(localeIdentifier: @"en_US") let d = NSDate() let s = dateFormatter.stringFromDate(d) ...
If you look at the method you have defined in Objective C image category, it is instance method and you are trying to call it using UIImage class in swift. You can basically use either one of the following two approaches, Either, self.backgroundImageView.image = self.someImage.applyDarkEffect() // notice the method does...
Based on the comments on the question, you mentioned that the words will never change. You could potentially create a whole bunch of if/else statements checking every word selected against every word in an array. I have put this down as a more efficient alternative and it should hopefully work....
ios,swift,uibarbuttonitem,uinavigationitem
You should set the menu_button_ as the rightBarButtonItem of your viewController rather than the navigationController. Try self.navigationItem.rightBarButtonItem = menu_button_ instead self.navigationController!.navigationItem.rightBarButtonItem = menu_button_ ...
You CANNOT do this because there is no available API for doing so and no custom URL ever for opening it directly into that app. So it is NOT possible sorry. I'd also say if you even found a way to do this it would be rejected under: 2.5 Apps...
first of all you need to create IBOutlet of both UISwitch in your header .h file @property (strong, nonatomic) IBOutlet UISwitch *isMale; @property (strong, nonatomic) IBOutlet UISwitch *isFemale; then in your IBAction do as follow. - (IBAction)isMale:(id)sender { if ([sender isOn]) { [_isFemale setOn:NO animated:YES]; } else { // do...
ios,xcode,swift,uigesturerecognizer
You can get a reference to the view the gesture is added to via its view property. In this case you are adding it to the button so the view property would return you you the button. let button = sender.view as? UIButton ...
If you don't want to use sessions, you can also use the simpler NSURLConnection Class, something like this: let url = NSURL(string: "https://wordpress.org/plugins/about/readme.txt") let request = NSURLRequest(URL: url!) NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) {(response, data, error) in println(NSString(data: data, encoding: NSUTF8StringEncoding)) dispatch_async(dispatch_get_main_queue()) { // Do stuff on the UI thread self.textField.text =...
ios,objective-c,exc-bad-access,nsobject
Verify that [dict objectForKey:@"infos"] is not NSNull - Crash can be here. Other code looks OK. Also add -(void)deallocto your object and put a break point there to verify that the object is not being released before the assignment. ...
ios,iphone,swift,audio,ios-simulator
You just need to move the declaration of your audioPlayer out of your method. Try like this: var audioPlayer:AVAudioPlayer! func playSound() { if let soundURL = NSBundle.mainBundle().URLForResource("doorbell", withExtension: "mp3") { audioPlayer = AVAudioPlayer(contentsOfURL: soundURL, error: nil) audioPlayer.prepareToPlay() audioPlayer.play() } } ...
ios,objective-c,iphone,objective
understand the autoresize concept , the following image is the description that how to we use the autoresizing on Left, right , top and bottom. So, I used to think according to this snapshot: Scenario 1: (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight) // it automatically set the width, height, left and bottom: Scenario...
ios,uinavigationcontroller,swrevealviewcontroller
Just set window.rootViewController to the login view controller.
You could just add a 'latest_activity' flag into every user and update it when the user uses your app. Then create a BackgroundJob (https://parse.com/docs/js/guide#cloud_code) and remove the anonymous users that are older than ~2weeks? What you could also do is setup Push Notifications in you app and for each user...
How about -searchBarTextDidEndEditing: in UISearchBarDelegate?
ios,objective-c,uitabbarcontroller
UITabBarControllerDelegate has a delegate method - tabBarController:shouldSelectViewController:, just implement it and check if user is logged in or not. e.g. - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController { if (isLogin) { return YES; } else{ //show your view controller here return NO; } } You can also check which view controller has...
You are trying to access the property viewControllers of the type UIViewController, which it doesn't have. viewControllers is a property on a UITabBarController, but viewControllers returns an array of UIViewController. Cast viewControllers to an array of UITabBarController (or only the item you extract) to access it's viewController property. Like this:...
ios,xcode,frameworks,transfer,projects
Try transferring everything from plists to the storyboard. I did this with a friend of mine and it only took about 20 minutes for the code to build and run successfully on his own laptop. the biggest issue is going to be transferring the files that Xcode is going to...
You can do it by using Aspect Ratio property of AutoLayout. You can follow this tutorial. It gives a very nice explanation on how to scale everything up by using fix aspect ratio. http://simblestudios.com/blog/development/percentage-width-in-autolayout.html...
Use an NSAttributedString for your label, and set the headIndent of its paragraph style: NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; style.headIndent = 14; NSDictionary *attributes = @{ NSParagraphStyleAttributeName: style }; NSAttributedString *richText = [[NSAttributedString alloc] initWithString:@"So this UILabel walks into a bar…" attributes:attributes]; self.narrowLabel.attributedText = richText; self.wideLabel.attributedText = richText; Result:...
ios,objective-c,xcode,swift,localization
Roll back those changes, add a InfoPlist.strings file to your project, localize it and then add the needed keys to it. For example: "CFBundleDisplayName" = "App display name"; "CFBundleName" = "App bundle name"; ...
You need to link the user to a facebook account, the code below does this link for you: if !PFFacebookUtils.isLinkedWithUser(user) { PFFacebookUtils.linkUserInBackground(user, withReadPermissions: nil, { (succeeded: Bool?, error: NSError?) -> Void in if succeeded { println("Woohoo, the user is linked with Facebook!") } }) } From Parse.com documentation: The steps...
ios,swift,uitableview,cocoa-touch,ios-charts
What you're trying to do is going to inevitably bump into some serious performance issues in one case or another. Storing all cells (and their data into memory) will quickly use up your application's available memory. On the other hand dequeueing and reloading will produce lags on some devices as...
ios,objective-c,delegates,protocols
When instantiated from a storyboard, the initWithCoder: methid is called, not the init method. DestinationViewController *destinationVC = [[destinationViewController alloc] init]; destinationVC.delegate = self; is how you do when your controller is not from a storyboard: you init it from the code. After that you have to manually handle the transition...
ios,objective-c,json,server,backend
You just need to POST data to your server. Port could be anything you want, should be 80. Host your script with a domain url so that you can make network request publicly. You can try this function: -(NSData *)post:(NSString *)postString url:(NSString*)urlString{ //Response data object NSData *returnData = [[NSData alloc]init];...
ios,objective-c,automatic-ref-counting
You needs to synthesize the property: @implementation Application @synthesize applicationState = _ applicationState; @end or declare the property again: @interface Application : NSObject <ApplicationProtocol> @property (nonatomic) ApplicationState applicationState; @end ...
ios,user-interface,uiviewcontroller
The "top area with clock" is called a status bar. That bar is transparent and is displayed as the topmost view in a window. This means that nothing can cover the status bar. You can show, hide and change the appearance of the status bar (changing the content from Light...
viewWithTag: is a very fragile way to get a reference to views, and isn't recommended. But what I think is happening is that you need to call viewWithTag: on cell.contentView rather than the cell itself. I'd recommend creating proper IBOutlets to hold your imageview and label....
No, you don't have to use both. Either you go with reloadCell technique or cell updates via beginUpdate and endUpdate. When you are reloading a particular row, internally table view system creates 2 cell and then blends in the new one with. You can remove the beginUpdates and endUpdates and...
Parse has a functions to object see to save many objects (see documentation here) PFObject.saveAllInBackground(array, block: { (succeeded: Bool, error: NSError!) -> Void in if (error != nil) { println("Error saving: \(error)") } }) Unfortunately the documentation is not update to Swift but you can see a list of the...
Your custom initializer cannot initialize the immutable property. If you want it to be immutable then, instead of creating a custom initializer, just initialize in one of the required or designated initializer. Like this, class AddBook: UIViewController { @IBOutlet weak var bookAuthor: UITextField! @IBOutlet weak var bookTitle: UITextField! let bookStore:...
Yes, this is possible using CloudKit. You'll need a CKContainer, and you'll ask it to fetch the user record ID. That record ID is unique for your apps, but is also stable for that user this means the same iCloud account will have the same record ID, regardless of which...
ios,objective-c,asynchronous,uiviewcontroller,nsobject
You'll have to 'remember' which UIViewController calls the object. This can be done for instance with a property. in .h @property (nonatomic) UIViewController *viewController; in your .m file @synthesize viewController; Before calling the method, set the property with anObject.viewController = self; Then, you'll be able to call [viewController finishedPost:self]; inside...
The ball gets reflected symmetrically to its angle of approach assuming it's a completely elastic collision. That means, to get the behavior you are looking for, the ball would need to approach exactly from one line mid-point to the next without any loss of energy. Sprite Kit's physics engine will...
ios,uiimage,title,uisegmentedcontrol
The official documentation for -setImage:forSegmentAtIndex: says A segment can only have an image or a title; it can’t have both. There is no default image. So, no, there is no way to do what you want using the image and title properties. However, there are a few options to accomplish...
ios,position,uigesturerecognizer
Make sure the buttons aren't handled with autolayout. If you are working in IB, make sure to remove all constraints from the buttons. Or, if you want to keep using autolayout, then update the constraints on the button rather than updating it's center position. You can do this by removing...
ios,objective-c,uitableview,nsurlsession
Besides assuming that your network requests aren't erroring (you should at least log if there are network errors), there are threading issues. Your NSURLSession callback probably runs on a background thread. This makes it unsafe to call UIKit (aka - [_tableView reloadData]). UIKit isn't thread safe. This means invoking any...
ios,objective-c,uiviewanimation,nslayoutconstraint
Since you would expect the orange button to move at some point, you can't force it to be centered. Lower the priority from 1000 to something lower. This means: I would really like it to be centered, but it doesn't have to be. Add a horizontal distance (leading/trailing) constraint...
ios,uitabbarcontroller,auto-rotation,shouldstartload
Try to override this method, don't call super - (void)viewWillTransitionToSizeCGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator { //[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; [self.selectedViewController viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; } ...
ios,swift,nsurlsession,completion-block
What I've done in the past is to create some sort of transaction object. I set up a download manager (as a singleton) to create an array of transaction objects. I make the transaction object the delegate of the URL session (Actually this predates NSURLSession - I did it with...
ios,swift,sprite-kit,cgrect,skphysicsbody
You are probably on the right track about .sks file. When scene is loaded from the .sks file the default size is 1024x768. Now you can dynamically set that based on the view size. So, swap your viewDidLoad with viewWillLayoutSubviews like this: override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() if let scene...
UIScrollView (from which UITableView inherits) has a alwaysBounceVertical property. If you set this to true, either in code or Storyboard, the table view will be vertically 'scrollable' regardless of how many rows it has.
ios,objective-c,sockets,chat,real-time
Assuming you've got your server side things setup, you can use Square's Socket Rocket to implement the client side https://github.com/square/SocketRocket If you're using socket.io at the backend, there are plenty of iOS libraries available for those as well. SIOSocket is one such library....
When the "Return Key" (or "Done") button is tapped, the delegate of your textfield will receive a set of callbacks including textFieldShouldEndEditing:, and textFieldDidEndEditing:. To respond to these, implement a UITextFieldDelegate and execute your action there, i.e. call loginActionButton in one of the delegate methods. Relevant Documentation: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextFieldDelegate_Protocol/#//apple_ref/occ/intfm/UITextFieldDelegate/textFieldDidEndEditing:...
ios,arrays,swift,parse.com,traffic
You can create Parse class for your feed objects. After that create an array column to store objectIds of users who added your feed item to favorit. When you want to find all the objects specific user bookmarked do something like PFQuery *query = [PFQuery queryWithClassName:@"feedObjects"]; [query whereKey:@"favoritesArray" equalTo:@"YOUR USER...
If use AutoLayout the use this code You try to set the UITableView properties estimatedHeight. -(void)viewWillAppear:(BOOL)animated{ _messageField.delegate = self; _tableView.estimatedRowHeight = 65.0; _tableView.rowHeight = UITableViewAutomaticDimension; } Other wise use this UITableView Delegate Method - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 300; // your dynamic height... } ...
Here is explanation: What is an "unwrapped value" in Swift? PFFacebookUtils.logInWithPermissions(["public_profile", "user_about_me", "user_birthday"], block: { user, error in if user == nil { println("the user canceled fb login") //add uialert return } //new user else if user!.isNew { println("user singed up through FB") //get information from fb then save to...
You likely need to enable "Test Mode" for your app in the AppLovin dashboard in order to force test ads to serve for your area. Please send any questions to [email protected] for further assistance.
android,ios,documentation,realm
If you look at the top of the webpage that you linked it says: Install in Dash. Dash is an app in App Store: https://itunes.apple.com/ro/app/dash-api-docs-snippets/id458034879?mt=12 that let's you view documentation offline....
ios,objective-c,nsdateformatter
You have to set the date format as the string NSString *myDate = @"06/18/2015 8:26:17 AM"; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"MM/dd/yyyy h:mm:ss a"]; NSDate *date = [dateFormatter dateFromString:myDate]; //Set New Date Format as you want [dateFormatter setDateFormat:@"dd.MM. HH:mm"]; [dateFormatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US"]]; NSLog(@"%@",[dateFormatter stringFromDate:date]); ...
I have figured out my own problem. During character movement through touch, the SKScene's -(void)update:(NSTimeInterval)currentTime method runs that characters class method [_player GPS:currentTime]; which tracks speed and distance. Here's the hiccup, that method sets the character texture according to the direction he is facing. Every frame the same texture continues...
You can put an UITapGestureRecognizer inside your UIImageView using Interface Builder or in code (as you want), I prefer the first. The you can put an @IBAction and handle the tap inside your UIImageView, Don't forget to set the UserInteractionEnabled to true in Interface Builder or in code. @IBAction func...
ios,objective-c,swift,uitextfield,uilabel
You can register your textField for value change event: [textField addTarget: self action:@selector(textFieldDidChange) forControlEvents:UIControlEventEditingChanged]; and in textFieldDidChange function update your label: - (void)textFieldDidChange { label.text = textField.text; } The function shouldChangeCharactersInRange is needed more for taking desisions whether to allow upcoming change or not...
ios,objective-c,swift,nsstring,nsmutablestring
appendString: is from NSMutableString, stringByAppendingString: is from NSString. The first one mutates the existing NSMutableString. Adds to the end of the receiver the characters of a given string. The second one returns a new NSString which is a concatenation of the receiver and the parameter. Returns a new string made...
Make sure that Member is declared in a place that your AppDelegate can "see" it. This concept is called "scope" and is crucial to many programming languages, including Swift. Classes declared inside other classes, for example, are not visible outside that class (unless they're given specific access modifiers). If that...
Replace the following in your code var latestLocation: AnyObject = locations[locations.count - 1] with the following. var latestLocation = locations.last as! CLLocation ...
ios,objective-c,pushviewcontroller
Update your AppDelegate.m file with following code self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; ExampleViewController *exampleViewController = [ExampleViewController new]; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:exampleViewController]; self.window.rootViewController = navController; //self.window.backgroundColor = [UIColor lightGrayColor]; [self.window makeKeyAndVisible]; The problem is that you are not initializing rootViewController from...
It's crashing because your handler object is getting released and deallocated right after the call to handler.sendMessage(), and then a delegate callback is attempted on that now-deallocated object when you try to send or hit cancel. The object is getting released and deallocated because nothing is holding a strong reference...
NSNumber is a class; NSInteger is just a typedef of long, which is a primitive type. dic[@"count"] is a pointer, which means that dic[@"count"] holds an address that points to the NSNumber instance. NSNumber has a method called integerValue which returns an NSInteger as the underlying value that the NSNumber...
MKLocalSearch with MKLocalSearchRequest is exactly what you are looking for. A basic search can be done as follows: MKLocalSearchRequest *request = [[MKLocalSearchRequest alloc] init]; request.naturalLanguageQuery = @"some address"; MKLocalSearch *localSearch = [[MKLocalSearch alloc] initWithRequest:request]; [localSearch startWithCompletionHandler:^(MKLocalSearchResponse *response, NSError *error) { // do stuff with the response }]; This should put...
If you don't know whether your image exists or not, you should use optional binding, try this: func setBGImage(myImageName: String) { if let bgColor = UIImage(named: myImageName) { self.view.backgroundColor = UIColor(patternImage: bgColor) } } If myImage exists, it will assign it to bgColor, in which is assigned to self.view.backgroundColor. or,...
ios,objective-c,push-notification
You are using the API wrongly. First of all the Push Notification API has changed after iOS 8.0. My answer will assume that you want to still supporting iOS 7.x and later // Checks if the application responds to the API introduced in iOS 8. if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) { //...
ios,objective-c,xcode,uiwebview
[self.webView reload] - will reload the current page. This is probably happening before the loadRequest has finished. Try removing this line. Also, @joern's comment is correct; the 'event' is the user making a pan gesture. Lose the timer....
Just set the modalPresentationStyle and modalTransitionStyle properties for the viewController. UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UIViewController *ivc = [storyboard instantiateViewControllerWithIdentifier:@"login"]; [ivc setModalPresentationStyle:UIModalPresentationCustom]; [ivc setModalTransitionStyle:UIModalTransitionStyleCrossDissolve]; [self presentViewController:ivc animated:YES completion:nil]; ...
First, You should always validate if the resource is available or not, try using: if(IS_IPAD && imagePicker.sourceType == UIImagePickerControllerSourceTypePhotoLibrary){ if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) { // present the popover } else { // HEY, YOU CAN'T USE THIS } } From the official docs: Because a media source may not be present...
ios,unity3d,shader,mesh,particle
You can do it using geometry shaders to create billboarding geometry from each vertex on the GPU. You can then either create the circles as geometry, or create quads and use a circle texture to draw them (I recommend the later). But geometry shaders are not extensively supported yet, even...
It fires everytime the getter is called. No way this could be optimized away. You might want to keep a preset colors array in sync with the photos property, i.e. change it directly when setting the photos. I also dislike the tight coupling in that place which seems unnecessary. I...
ios,watchkit,watch-os-2,watch-os
Yes, you'll have to maintain two separate stores. If either side is a "read-only" client and the CoreData datastore is small and changes infrequently you could potentially use the transferFile WatchConnectivity API to transfer the whole store each time it changes.
ios,arrays,swift,casting,type-conversion
Airspeed Velocity gave you the answer: var arr: [Int] = [1,2,3,4,5] var stringArray = arr.map { String$($0) } Or if you want your stringArray to be of type [String?] var stringArray = arr.map { Optional(String$($0)) } This form of the map statement is a method on the Array type. It...