FAQ Database Discussion Community


UIWebView path depends on previous pressed button Xcode

ios,objective-c,iphone,xcode,uiviewcontroller
I have a ViewController (A), containing n buttons. all buttons map to other ViewController(B) containing a WebView to show a different PDF. Instead of creating n ViewController, I would know how to change path according to which button was pressed. my wrong tries: 1- use tags of buttons in ClassB...

Height did not update when switch from portrait to Landscape?

ios,objective-c,iphone,landscape-portrait
I create a UIScrollView, added other data in it, added subview to self.view. The problem is that when i switch my phone from portrait to landscape or vice versa it do not update the height so my scrollview do not work as i need to. here is the code: UIScrollView...

Setting up NSPredicate with a phrase and number sequence

objective-c,nspredicate
I'm sorry if this is an overly specific question. Tried searching for basic help with NSPredicate and getting nowhere. I'm trying to validate a string that should begin with a particular word (let's say it's SPOT, in all caps) and is followed by exactly 4 numeric digits. In other words,...

iOS Bring UIView up before keyboard?

ios,objective-c,uiview,keyboard
I have two UIViews inside my UIView. Here is my view: On textfield focused, keyboard is shown and keyboard hides my textield. I want to move whole TextField View up before keyboard. I've found code example here on stackoverflow: iPhone Keyboard Covers UITextField This is the code: - (void)textFieldDidBeginEditing:(UITextField *)textField...

CPU & Memory steadily increase & FPS drops all because of vector movement

ios,objective-c,sprite-kit
My CPU & Memory steadily increases over the course of roughly 6 minutes during play testing of my current Sprite Kit game. I've found that the method '-(void)walkToward:(CGPoint)targetPosition' inside the Player class is responsible (it moves the character to a tapped location on screen), but I DON'T understand why. The...

How can I get my iPhone to listen for sound frequencies above a certain threshold?

ios,objective-c,iphone,audio
I'm interested in getting my iOS app to turn on the microphone and only listen for frequencies above 17000 hz. If it hears something in that range, I'd like the app to call a method. I was able to find a repository that detects frequency: https://github.com/krafter/DetectingAudioFrequency And here is a...

UIAlertAction completion block not called - iOS

ios,objective-c,cocoa-touch,uiactionsheet,uialertcontroller
I have an iOS app with a UIAlertController in the form of a action sheet being presented in my app when the user taps on a button. It all works great, apart from one thing, the completion blocks don't get called for some reason. Here is my code: // Setup...

What is the best practice add video background view?

ios,objective-c,swift,video
I want to add background view with video (or gif) like in app "Uber" I'd like to use video background view for a long time in my app. And I want to know the answers to these questions: What of them will consume less battery energy Can I use it...

How to know a file is writing via NSFileManager

ios,objective-c,iphone,nsfilemanager
I got a problem , How to know the file is accessible ??? For example , the file is writing , but not finish yet. And I check the file again , I use [[NSFileManager defaultManager] fileExistsAtPath:filePath]; It return true ... but the file is not accessible . How to...

Set background color of .xib launch image background

objective-c
I need a specific hex code to be background color, not drop down from a list of pre-made choices. How do I accomplish this?

NSTimer firing more than it should

ios,objective-c,selector,nstimer
I do understand that it's my problem but not the problem of NSTimer but I would be really grateful if anyone could help me. In my project I need to call this method every 0.5 seconds for 2 objects. The problem is that the timer fires at different moments of...

CFNotificationCenterRemoveEveryObserver not removing the observer

ios,objective-c
I am using CFNotificationCenterAddObserver() function to register a notification as below CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, ringerSwitched, CFSTR("com.apple.springboard.ringerstate"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately); Later at some point I am removing it via CFNotificationCenterRemoveEveryObserver() function as below but call back method is still getting called. CFNotificationCenterRemoveEveryObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL); I also used...

Navigation Bar disappeared when rotate the device

objective-c
I have a project, which have relationship segue as photo below.Everything work fine. But When I rotate the device/ iOS simulator The Navigation Bar is disappeared. What happen ? Some setting I need to know ? LINK TO IMAGE...

How to push a view from project that based on Tab Bar Controller

objective-c
I have a project based on Tab Bar Controller. BUT There is one view that I has to be pushed from a button in View which belong to Tab bar controller. This is very crazy for me that I can not push the view because that last view is not...

NSString to NSDate doesn't work

ios,objective-c,nsdateformatter
now it works with this code: NSString *myDate = @"06/18/2015 8:26:17 AM"; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"MM/dd/yyyy hh:mm:ss a"]; [dateFormatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US"]]; NSDate *date = [dateFormatter dateFromString:myDate]; [dateFormatter setDateFormat:@"dd.MM. HH:mm"]; NSString *dateString = [dateFormatter stringFromDate:date]; cell.timeLabel.text = dateString; ...

Custom transition iOS (Push/Pop)

ios,objective-c,animation,uiviewcontroller,custom-transition
I created a custom zoom-in transition when pushing a new viewController, and it used to work perfectly fine. Now I want to create a zoom-out effect when popping the viewController, and even-thought the final state is correct, the animation is wrong since I don't know how to identify if it...

iPod Touch (5th gen) 'Source type 1 not available' crash when using UIImagePickerControllerSourceTypeCamera

ios,objective-c,ipod-touch
The iPod Touch (5th gen) has both a front and rear camera so why does my app crash when i try to present a UIImagePickerController with sourceType: UIImagePickerControllerSourceTypeCamera - (void)openImagePickerType:(NSString *)type { UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; if([type isEqualToString:kImagePickerCameraString]) imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; if([type isEqualToString:kImagePickerLibraryString]) imagePicker.sourceType =...

UIButton with pushViewController that is declared in another class

ios,objective-c,uiviewcontroller,uibutton
Hi everyone I am trying to add a custom nav bar that is declared in a different class and has a button that make a push action. My initial problem was that when the app was pushing the view because of the uinavicgationconreoller it was crashing, I fixed that somehow...

Assigning a variable from another class

ios,objective-c,methods,protocols
I have a UIView with a UIButton created in 1 class: "viewClass". In my mainVC class, I called viewClas and I needed to call a method in mainVc when the button is selected, so I created a protocol. (I hope that was clear.) Here's how I set up the protocol...

Trying to dismiss a popover view controller with a table view inside of it

ios,objective-c,uipopovercontroller
I'm trying to dismiss a popover when selecting a cell inside of it. I have created a custom delegate to support this however it is not working: In my class that houses the PopOver and table View I have the following: In .h: @protocol DismissDelegate <NSObject> -(void)didTap; @end @interface AssistanceNeededAtPopOverViewController...

After an insert into the UITableView : custom the cell

ios,objective-c,uitableview
I'm using insertion into my UITableView with this : Skill * newSkill = [[Skill alloc] init]; newSkill.name = @"Nouvelle compétence"; newSkill.pathPicto = @"generic"; [self.skills insertObject:newSkill atIndex:0]; NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [self.tableView beginUpdates]; [self.tableView insertRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationTop]; [self.tableView endUpdates]; It works great but now I want that the inserted cell be...

Delete child SKSpriteNode

objective-c,iphone,sprite-kit,skspritenode
Basically I am trying to make it so that when the user hits a fuel tank the old tank disappears and a new one is spawned in a random location. Right now it's detecting the collision but I can't get rid of the child. It will just add a new...

How can I find out the Objective-C generics type?

ios,objective-c,xcode,generics
Xcode 7 contains an Objective-C variant, where you can define a type-hint for (homogenous) NSArray return values and properties, defined such as NSArray<UIImage*>. I'd like to use this feature to rewrite my JSON-deserializer class (which needs such kind of type hints – previously I have solved this by adding a -(Class)jsonHintForKey:(NSString*)key...

Does NSURLSession Take place in a separate thread?

ios,objective-c,grand-central-dispatch,nsurlsession
I was designing an app that uses NSURLSession and thinking about putting it in a different thread with Grand Central Dispatch, but if NSURLSession automatically does that in the background, I wouldn't have to use GCD then, correct? So in other words, does NSURLSession automatically use Grand Central Dispatch in...

UINavigationItem setLeftBarButtonItems Delay

ios,objective-c,uinavigationitem
I have a rather confusing problem: In my application I am checking for network connectivity and if the user is not connected to the internet I am showing a little red exclamation mark in the navigation bar. The Code that is used to show the exclamation mark looks like this:...

Initializing a xib view as a subview of another NSView

objective-c,osx,cocoa,xib,nib
I'm trying to learn OSX development, and I've created a view in a .xib file, and I'm trying to initialize and then add this view as a subview. I've googled how to do this, and all of the solutions are for iOS and use a call such as MyViewClass* myViewObject...

Override UITabBarController Icon Selection

ios,objective-c,uitabbarcontroller
I'm using a standard UITabBarController with icons at the bottom, each bringing to it's ownViewController. My question is basically: Is there a way to override what happens when an icon is selected rather then directly bringing them to the view? Reason being is because I'm adding a login screen to...

Cursor doesn't update in NSTextField as it autoresizes when resizing the enclosing NSWindow

objective-c,cocoa,nstextfield,autoresize,nscursor
I have an NSTextField that autoresizes. Its text is centered. When I start typing in the field and then resize the enclosing NSWindow, the cursor stays where it's at rather than repositioning to the appropriate place : I've also made an XCode project demonstrating this problem : https://www.dropbox.com/sh/cohhmslyl9ti43b/AAC6ULteopsQCMDsEArJU15Ta?dl=0 Does anyone...

AVCaptureOutput didOutputSampleBuffer stops getting called

ios,objective-c,avfoundation,avcapturesession
I have an issue with the delegate method didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection of AVCaptureOutput. It stops getting called within a second or two when I'm adding the sampleBuffer to a CFArray. If I remove the CFArray code, the delegate method continues to get called so I have no idea why the...

Auto Rotation iOS 8 Navigation Controller

objective-c,iphone,ios8,uinavigationcontroller,autorotate
I have certain viewControllers which are managed by a UINavigationController (push and pop). I want to restrict different viewControllers to different orientations like the first one should be only in Portrait, second in portrait, third in landscape and fourth can be portrait and landscape both. I set a ViewController on...

UIImage returns null first time, until reloaded? [duplicate]

ios,objective-c,uiimage,nsurl
This question already has an answer here: didReceiveData is not getting all data 2 answers I retrieve NSData from a url, then I try set it to an image. In the console it returns null, however when I request the data and set the image again, the image than...

Build error after I localized Info.plist

ios,objective-c,xcode,swift,localization
I localized Info.plist : And I got this build error : error: could not read data from '/Users/cherif/Apps/Wesh/Info.plist': The file “Info.plist” couldn’t be opened because there is no such file. Actually there are now two Info.plist files : fr.lproj/Info.plist Base.lproj/Info.plist How to localize the Info.plist path ?...

Calling UIView from UIController

ios,objective-c,uiview
I am trying to call a UIView FirstScreen from my ViewController. But I don't know how to do it. ViewController: #import "ViewController.h" #import "FirstScreen.h" @interface ViewController () { FirstScreen *f; } FirstScreen.m: #import "FirstScreen.h" @implementation FirstScreen - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self didLoad]; } return...

Slide in an UIButton and push other UIButton when a certain distance is reached

ios,objective-c,uiviewanimation,nslayoutconstraint
I would like to slide in a UIButton (grey color in screenshot) from the left to right and center it on the screen. There is an UIButton (orange color in screenshot) already though that is centered and this button should be pushed to the right and always have a distance...

how to share screenshot to Facebook

objective-c,facebook,facebook-sdk-4.0,social-media
I've already done that screenshot part, but still haven't found any solution to share the screenshot image to Facebook by using FBSDKSharePhoto. Facebook doesn't provide enough references for it. Can anyone please guide me here? Here is my screenshot code just in case: CGRect screenRect = [[UIScreen mainScreen] bounds]; UIGraphicsBeginImageContextWithOptions(screenRect.size,...

Fit a UIImageView to a UIImage

ios,objective-c,uiimageview,autolayout
I have a UIImage View that is set up using AutoLayout and constraints. I fit the image to the Image View using self.selectPhoto.contentMode = UIViewContentModeScaleAspectFit; NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:0 toItem:self.selectPhoto attribute:NSLayoutAttributeTop multiplier:1 constant:-10]; NSLayoutConstraint *bottomConstraint = [NSLayoutConstraint constraintWithItem:self.selectPhoto attribute:NSLayoutAttributeBottom relatedBy:0...

Multiple NSURLSessions Causing UITableView Problems

ios,objective-c,uitableview,nsurlsession
I'm running into a bit of a strange problem here. One of my NSURLSessions is in charge of getting information for restaurant information that I have stored (restaurant name, restaurant's logo URL, etc), and then the second NSURLSession is in charge of using the restaurant's logo URL to retrieve the...

UIToolbar with UISegmentedControl AutoLayout (/full width)

ios,objective-c,autolayout,uisegmentedcontrol,uitoolbar
I have a UIViewController with a UIToolBar below the UINavigationBar and a UITableView below that. The only UIBarButtonItem on my UIToolBar is a UISegmentedControl as in the screenshot below: However, how do I get the UISegmentedControl/UIBarButtonItem to stretch to fill the UIToolBar like in the App Store app? Keep in...

Progressive HMAC SHA256 in Objective-C

javascript,objective-c,cryptography,hmac,cryptojs
I need to generate a hash using HMAC SHA256. I am using the following code in JavaScript. I need an equivalent code in Objective-C. function serialize( obj ) { return Object.keys(obj).reduce(function(a,k){a.push(k+'='+encodeURIComponent(obj[k]));return a},[]).join('&') } var query = { Action : 'MyAction', SignatureMethod : 'HmacSHA256', }; var hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, 'MYVALUE'); var...

Multiple ways to present UIViewController's view [closed]

ios,objective-c,uiview,uiviewcontroller
I'm fairly new to iOS and working on someone else's project, and I notice that there seems to be various different ways to present a view. I'm wondering if someone could give a brief summary of the various ways to present a view, and when to use which one, because...

Using sockets to build real time chat for iOS?

ios,objective-c,sockets,chat,real-time
If I wanted to build a real time chat app for iOS using Objective-C, what would be the best way of going about it?

UITableView(grouped) adds extra empty header at the bottom

ios,objective-c,uitableview
I'm a bit newbie to objective C and iOS, so my question can be stupid:) I've checked self.tableData in debug mode, there's no empty items there, and numberOfSectionsInTableView returns correct value. Here's UITableView data source methods: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSArray *arr = self.tableData[section]; return arr.count; } - (NSInteger)numberOfSectionsInTableView:(UITableView...

Set color CFAttributedStringRef

ios,objective-c
I have this methods for draw a table ant populated . What i want is to change the color for one word from each column , but i dont know how can i do it . Can somebeday help me ,please ? Any help will be appreciate . in my...

Blocking a Loop Using UIAlertController

ios,objective-c,swift,uialertcontroller
is there a way for us to block a for loop? I have a loop where inside it, it ask user with a dialog box. I would like it to pause the loop after user press OK or Cancel. Is it possible? Because looping an alertController looks really ugly especialy...

Google Drive API (GTL) - Create multiple folder paths in order?

ios,objective-c,swift,google-drive-sdk,google-api-objc-client
I'm using the Google APIs Client Library for Objective-C (GTL) to access the Google Drive API. According to it's Introduction to the Google APIs Client Library for Objective-C, Query execution by the service is inherently asynchronous. Which means when you try to create a path like: root/a/b/c, before you can...

Checking If One Array Contains An Object of Another Array In Objective C

ios,objective-c,arrays
I am using below function to check whether if an object in an array is present in another array. If the object not present, then I will ADD that object to the new array, or else that object will NOT be included in the new array that I instantiated. +...

NSExpression custom variables inside expression

ios,objective-c,swift,expression
Recently I have discovered NSExpression class and I am wondering is there a possibility to evaluate custom variables inside expression. Something like this: 5+4+MYVAR*5 I would like to replace this MYVAR string with custom Double value. If this don't exists, I will go with loops and similar, but hoping that...

How to prevent duplicate entry on parse?

ios,objective-c,iphone,swift,parse.com
I' trying to save song info to parse, but if the song already exist in parse I want my code just do nothing. I've tried this code below: var Music = PFObject(className:"Musics") var query = PFQuery(className:"Musics") query.findObjectsInBackgroundWithBlock { (objects: [AnyObject]?, error: NSError?) -> Void in if error == nil {...

pushviewcontroller doesn't work?

ios,objective-c,pushviewcontroller
There is a button at the viewcontroller and when i click the button pushviewcontroller doesn't work. my appdelegate.m file : - (BOOL)applicationUIApplication *)application **didFinishLaunchingWithOptionsNSDictionary** *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:EK_SCREEN_BOUNDS]; ExampleViewController *exampleViewController = [ExampleViewController new]; self.window.rootViewController = exampleViewController; [self.window makeKeyAndVisible]; return YES; } Button click method (in ExampleViewController): mainViewController...

Call function on Server from iOS app - Objective C

ios,objective-c,json,server,backend
If you are familiar with Parse.com's Javascript SDK, this is what I am trying to do for my own server for my iOS app (Objective-c). I want to be able to send some a string to the function that is on my server, have the server run its function and...

Setting delegates (for protocols) only works in prepareForSegue?

ios,objective-c,delegates,protocols
Most of the information I found involving implementing protocols and delegates involves a step where you do this; DestinationViewController *destinationVC = [[destinationViewController alloc] init]; destinationVC.delegate = self; But after hours of frustration because I couldn't get it to work I finally stumbled across another way to allocate the destinationVC in...

Get warning when convert double to NSDecimalNumber

ios,objective-c,methods,double,nsdecimalnumber
I'm trying to convert a double to an NSDeciamlNumber. Here is my code: - (NSDecimalNumber *)myMethod { double amount = 42; ... return [NSDecimalNumber numberWithDouble:amount]; // Get warning here } But I get the following warning: Incompatible pointer types returning 'NSNumber *' from a function with result type 'NSDecimalNumber *'...

Facebook logout iOS SDK

ios,objective-c,iphone,facebook
In the latest SDK of Facebook for iOS 8, the login button itself changes to logout once the user logs in successfully. I have a separate logout button in my applications. When the user is successfully logged in using my own server credentials, google+ or facebook, the app takes the...

remote data fetching inside model object in objective c using AFNetworking

ios,objective-c,rest,model-view-controller,afnetworking-2
In all of my iOS application I use this approach to respect MCV, I want to be sure that my implementation is correct and respects the best practices and the MVC design pattern : Singleton of AFNetworking acting as API for network calls: MyAPI.h : #import "AFHTTPSessionManager.h" #import "AFNetworking.h" @interface...

Filter array based on coordinate from mapview frame in objective C

ios,objective-c,xcode,annotations,mkmapview
I have hundred's of map annotation. Annotation are from array of dictionary with lat and long val same data shown in table view. Table view and map view are same view based on screenheight/2. What I need for example in my array have 100 lat and long value table view...

I am doing demo for video streaming as same as source code from git hub but I am getting errors?

ios,objective-c,iphone
[1]: https://github.com/slavavdovichenko/MediaLibDemos3x From this link I downloaded source code and I am running it in X-Code 6.3.2 but I am getting two errors can any one check it please give me a solution. Error 1- Undefined symbols for architecture i386: "_OBJC_CLASS_$_BroadcastStreamClient", referenced from: objc-class-ref in ViewController.o Error 2- ld: symbol(s)...

Updating Core Data Model using two separate View Controllers

ios,objective-c,uitableview,core-data
I originally had my app setup to store one line items in a single entity within my core data model. I have since decided to change this to allow the main uitableview to simply list the name of each item and then when you tap on an item you can...

It is possible to continuously update the UILabel text as user enter value in UITextField in iOS

ios,objective-c,swift,uitextfield,uilabel
In my application i have one UILabel and UITextField. Initially UILabel text in nil. As soon as user enter some text in UITextField my UILabel text also Update. Let say When user enter A in UITextField my UILabel immediately show A, B in UITextField my UILabel show B and so...

Objective-C AVCaptureDevice Front Camera

ios,objective-c,camera,avcapturedevice,avcapture
I have followed a tutorial that guided through a way to make a custom but simple camera app, almost exactly to the needs of the use I would like it. I actually have two issues that I need changing but I will focus on this first one for now. The...

drawing views after time intervals

ios,objective-c
I need to draw views after time interval for example creating the first view then wait 5 second and create the other one, I am using this: -(void) drawView { int x=0; x+=16; UIView *view = [[UIView alloc] initWithFrame:CGRectMake(x, 580, 16, 25)]; view.backgroundColor = [UIColor blackColor]; [self.view addSubview:view]; } [self...

Can you call dispatch_sync from a concurrent thread to itself without deadlocking?

ios,objective-c,multithreading,swift,grand-central-dispatch
I know you would deadlock by doing this on a serial queue, but I haven't found anything that mentions deadlocking by doing it on a concurrent queue. I just wanted to verify it wont deadlock (it doesn't seem like it would, as it would only block one of the threads...

Xcode referencing old copies of files

ios,objective-c,xcode,file-management
Changes I've been making to code in certain files are being ignored by Xcode. I've traced it to the fact that Xcode is keeping its own older version of the code files somehow... these older/duplicate files are not shown anywhere in the Finder window for the project's folder and persist...

objective c - click table row and go to another page

ios,objective-c,tablerow
I want to user click table row then after it user will go to other page. The page has Storyboard ID "Other View" and Restoration ID "Other View". But I can't go to purposed view This is my code : - (UITableViewCell *)tableView:(UITableView *)tabel cellForRowAtIndexPath:(NSIndexPath *)indeksBaris { static NSString *simpleTableIdentifier...

starting to work with iOS push notifications

ios,objective-c,push-notification
i started following this tutorial i found via google. http://code.tutsplus.com/tutorials/setting-up-push-notifications-on-ios--cms-21925 However i got stuck on basically the first step where it said that the methods are deprecated, i changed them to the ones suggested by Xcode the original code was [application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)]; i changed it to...

Crash when processing `__Atom` class object in Objective C (using Objective C runtime )

objective-c,osx,objective-c-runtime
Hi I'm using this answer to get list of class to automatically build some structure. My code looks like that: NSMutableDictionary *result = [NSMutableDictionary dictionaryWithCapacity: 32]; Class* classes = NULL; int numClasses = objc_getClassList(NULL, 0); if (numClasses > 0 ) { classes = (Class*)malloc(sizeof(Class) * numClasses); numClasses = objc_getClassList(classes, numClasses);...

Load images from “HTTPS” type of url and display in UIImageview

ios,objective-c,https,uiimageview,xcode6
I am developing an iOS app in which I receive "HTTPS" URLs from server for images. I am now unable to load images from those URLs. I have tried several frameworks like AFNetworking, SDImageView, etc. But none of them are able to load image from these type of URLs. Update:...

In objective-c how can i get the “url” and “content” between tags using regular expression?

html,objective-c,regex
The <a> tag like this: <a data-hash="9aab8aa3af7dc519c643fdcfd973b040" href="http://www.zhihu.com/people/9aab8aa3af7dc519c643fdcfd973b040" class="member_mention" data-editable="true" data-title="@somebody" data-tip="p$b$9aab8aa3af7dc519c643fdcfd973b040">@somebody</a> and I want get the url href="http://www.zhihu.com/people/9aab8aa3af7dc519c643fdcfd973b040" and the @somebody at the same time I have tried like this: href=\"(.*?)\">(.*?)</a> The result is:...

SceneKit + Collada + animation

objective-c,animation,blender,scenekit,collada
I am trying to use Apple's SceneKit in order to load a model from Blender in Collada (dae) format, then apply animation on it from another Collada file, just like Apple did in their Banana example. I can do this with their models and animation files, however, if I open...

Is it possible to highlight ObjC code in Intellij IDEA?

objective-c,intellij-idea,syntax-highlighting
Intellij IDEA have IDE AppCode for iOS projects on ObjC/Swift. I am develop crossplatform app (android and ios supports) on Cordova which contain Java, JS and ObjC as base languages. And unforunately IDEA do not highlight ObjC code. I have not found a plugin that would it did. Is it...

iOS: Programmatically called segue not working

ios,objective-c,swrevealviewcontroller
I am using a SWRevealViewController segue that is called via method but isn't getting triggered. No errors are reported to the log, and it doesn't cause the app to hang or crash. I've checked the segue link on the storyboard and it has the correct class and identifier. - (void)viewDidLoad...

NSPredicate crash with path which contains square brackets

objective-c,cocoa,nspredicate
I have to search paths which contains square brackets in it from core data. But when I trying to create search query like below, xcode crashes. path == /my/local/[path] I've tried to escape square brackets, from one brackets to 16 brackets, but nothing works. That path is from another application,...

Copying Variable Names

objective-c
<code> //header file has appropriate declarations but not included here: #import "AddressCard.h" @implementation AddressCard; -(NSString *) name { return name; } //Recommended code: -(void) setName: (NSString *) theName { [name release] name = [[NSString alloc] initWthString: theName]; } //Incorrect code according to Kochan: -(void) setName: (NSString *) theName { [name...

Read plist inside ~/Library/Preferences/

objective-c,xcode,osx
I'm trying to access in ~/Library/Preferences/ but my code doesn't work. NSString *resPath = @"~/Library/Preferences/"; NSError *error = nil; NSArray *filenames = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:resPath error:&error]; if (!error) { for (NSString * filename in filenames) { NSLog(@"%@", filename); } } Maybe I should ask for some permission.. Any idea?...

How do you work with views in MainMenu.xib?

objective-c,xcode,osx,cocoa
I'm coming over from iOS development and I can't figure out this basic thing: if I open MainMenu.xib in Interface Builder and I drag a button onto the main window's view, what class should I connect that button's action to -- the App Delegate? If I want to add a...

Set NSObject property - EXC_BAD_ACCESS

ios,objective-c,exc-bad-access,nsobject
Process : App is on the home view controller and is requesting data on API to set an NSObject property. The request is processing on a private method. User change the view controller to a second view controller (the request is still processing asynchronously) The second view controller is loaded...

Xcode UIWebView not changing page with changed URL

ios,objective-c,xcode,uiwebview
I'm automatically generating a NSURL based on the distance of a pan gesture on the screen (long story...). Anyways, I'm having no problem generating the URL. The URL dynamically changes, and then I have an NSTimer that repeats every second which tells a UIWebView to reload with the new URL....

When replicating UIAlertView; background is not the same

ios,objective-c,uiview,uialertview
I'm creating a custom UIAlertView (from a UIView). I'm trying to get the same background effect (when the background view darkens). So I created a new black UIView with .5 opacity, and added it to the background. The problem is, I have a tab bar. When the black UIView covers...

Obj-C Instance method returning a instanceType called from Swift - Function produces expected type 'UIImage!' error

ios,objective-c,swift
I have this instance method in an existing Obj-C UIImage category: - (UIImage *)applyDarkEffect; I'm trying to call it from a Swift file like so: self.backgroundImageView.image = UIImage.applyDarkEffect(image) But get this compiler error: Function produces expected type 'UIImage!'; did you mean to call it with '()'? ...

How can i use MapKit View in Xcode 6.3?

ios,objective-c,iphone
I am unable to use MapKit in Xcode 6.3. It is showing an error when I am create property for that. The Error is- Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named MKMapView'

Nested animation in iOS: combine animated and non-animated code in animateWithDuration?

ios,objective-c,animation,nested,animatewithduration
Nested animation In short the nested animation allows to run 2 independent animations simultaneously. But what to do if I have a complex code which consists of both animated and non-animated code? I mean the following situation: [UIView animateWithDuration:... animations:^{ ...//code1 - with animation ...//code2 - also contains code which...

Dispatch group and NSNotification

objective-c,grand-central-dispatch,nsnotificationcenter,nsnotification
My issue is simple. I have 3 tasks, one is triggered by an NSNotification. How to I wait for all task to be completed before proceeding. So far, I tried using dispatch group but can't find a way to add the task triggered by NSNotification. (I tried adding the dispatch...

iOS - Automatically Have Keyboard Toggled On ViewController

ios,objective-c,keyboard
I have a view in my app where the user has to enter information in a textfield. Instead of them clicking into the text field and toggling the keyboard, I would like to have the textfield already editable with the keyboard preloaded there so the user can immediately start typing....

iPhone - get amplitude of audio at current point

ios,objective-c,iphone,avaudioplayer
First off: I don't know much about audio processing. I know with Core Audio, you can get the info about a playing track. My goal is to have a node in SpriteKit with the current amplitude/loudness of the current song from iTunes being its scale (say, scale should be at...

Objective C - bold and change string text size for drawing text onto pdf

objective-c,xcode,pdf,size,bold
I've created a .xib file with a uiview solely for the pdf document that I have created. I've primarily followed this tutorial for code: http://www.raywenderlich.com/6818/how-to-create-a-pdf-with-quartz-2d-in-ios-5-tutorial-part-2 From the above, I can't edit labels (plain or attributed) from the interface builder as even after changing size, it doesn't apply when the app...

Is there a strong case against making my TyphoonAssembly a singleton? If so, why? If not, is there a recommended way to do so?

ios,objective-c,dependency-injection,typhoon
I'm getting started with Typhoon and finding that it is annoying to keep writing constructors with additional assembly arguments. So it is tempting to just make my TyphoonAssembly a singleton. But I've yet to see that done in any examples, and I do see examples where constructor or property injection...

Difference between stringByAppendingString and appendString in ios

ios,objective-c,swift,nsstring,nsmutablestring
What is the difference between stringByAppendingString and appendString? If NSString is not mutable then how could it append string?

VoIP limiting the number of frames in rendercallback

ios,objective-c,audio,core-audio,audiounit
I am currently developing a VoIP application and one of the libraries I am using requires me to send the frames in the input call back. The requirements is that I must send a sample count which is defined as the number of samples in a frame. This callback will...

NS_ENUM as property in protocol

ios,objective-c,automatic-ref-counting
I came across to strange behaviour. I used to have: @property (nonatomic) ApplicationState applicationState; directly in my Application class. Now it's extracted to protocol @protocol ApplicationProtocol <NSObject> @property (nonatomic) ApplicationState applicationState; ApplicationState is Enum typedef NS_ENUM(NSUInteger, ApplicationState) { ApplicationStateNormal = 0, ApplicationStateExpanded = 1, ApplicationStateMaximized = 2 }; Now. It...

iOS: What is the callback when tapped on the empty space between keyboard and search bar to dismiss the keyboard when search bar is active

ios,objective-c,swift
I have SearchController for my TableViewController. I wanted to perform some actions when user taps on the empty space on the screen (between the keyboard and search bar) to dismisses the keyboard and displays the main Table View.

Call method after asynchronous request obj-c

ios,objective-c,asynchronous,uiviewcontroller,nsobject
In my app I init a new object, where there is method which calls NSURLConnection's sendAsynchronousRequest method. After the request, I would like to call a method in the caller UIViewController. I tried to use a static method but I then I can't control IBOutlets. How can I do this?...

Programmatically using constraints to center a UIIMageView

ios,objective-c,uiimageview,autolayout,xib
I'm working on an iOS project in which I need to programmatically use constraints for my views. I'm used to storyboards, but am using xibs for this particular project due to the nature of the project specification. I have a MainViewController, in which I create the following properties in the...

Unexpected NSWindow becomes key window

objective-c,cocoa,nswindow,keywindow
I have a main NSWindow in my application with a button. When the button is pressed it does something like the following: NSWindow *newWindow = [NSWindow initWithContentRect:[screen frame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; [newWindow makeKeyAndOrderFront:self]; [self.previousWindow orderOut:self]; This works fine most of the time, but if I have a second window open...

how i can solve Image auto resize in iphone 4 5 6 6+

ios,objective-c,iphone,objective
I give three types of image like image.png [email protected] [email protected] but not working image autoresize in all device....

Indent second line of UILabel

ios,objective-c,uilabel
So I have a UILabel that may or may not go to a second line, depending if it is on iPhone or iPad. What I would like to accomplish is to have it indent on the second line to line up correctly, if needed. On iPad it will almost never...

How to do a “show (e.g Push)” segue programatically without animation?

ios,objective-c,swift,storyboard,segue
How can I do a "show (e.g Push)" segue programatically without animation? None of the solutions I've found works the same way as the one in storyboard.

KVO. ObserveValueForKeyPAth is not called

objective-c,nsmutablearray,key-value-observing
I am not if this will work properly [[cr1.crossRoad.trafficLights objectForKey: [NSNumber numberWithInt:pedestrianTL]] addObserver:view forKeyPath:@"colorState" options:NSKeyValueObservingOptionNew context:nil]; The project I'm developing doesn't work properly. This way I was trying to add an observer to change the view with after every change happening to the cell of the colorState array. -(void) observeValueForKeyPath:(NSString...

Calling dispatch_sync from a concurrent queue - does it block entirely?

ios,objective-c,multithreading,swift,grand-central-dispatch
Let's say I hypothetically call a dispatch_sync from a concurrent queue - does it block the entire queue or just that thread of execution?

__createApplicationIconFromImage_block_invoke: Error: unable to create icon mask image from image named “AppIconMask.png” at scale 2.0

ios,objective-c,cordova,phonegap-plugins
I am getting "___createApplicationIconFromImage_block_invoke: Error: unable to create icon mask image from image named "AppIconMask.png" at scale 2.0" error while opening a PDF Viewer using iOS Cordova phone-gap based application Unknown activity items supplied: ( "QLPrintPageRenderer: 0x187bc720>", "UIPrintInfo: 0x1c0b51f0>" ) //While executing present View : [self.documentInteractionController presentPreviewAnimated:NO]; Can anyone please...

Call textFieldDidEndEditing of UITextField when press UIButton

objective-c,uitextfield
Is there anyway to call textFieldDidEndEditing of UITextField when pressed UIButton? Current process is function in textFieldDidEndEditing can work when user press "Return" or "Done" button and click on UIButton. To make it clear, if ABC function in textFieldDidEndEditing to be run, user must press "Return" or "Done" button of...

Size Class Initially Unknown

ios,objective-c,storyboard,size-classes
I am trying to setup my UI on my universal app. I have a storyboard setup with size classes, a fairly simple UI. I have my view controller with a view in. Inside this view, I draw a chart so this can only be updated using setFrame. This is where...