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. ...
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...
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....
The connection:didReceiveData: method is called repeatedly as the data is loaded incrementally. You probably want the connectionDidFinishLoading: method instead. By the way, you'll still likely need a connection:didReceiveData:, but rather than trying to create the image, you'll just be appending the new data to a buffer. Then in the connectionDidFinishLoading:...
objective-c,intellij-idea,syntax-highlighting
I found this, but it is only syntax highlighting, not auto-complete. For that I'am afraid you will have to use AppCode or Xcode. https://github.com/jkaving/intellij-colors-solarized...
Check the Navigation Controller properties in the interface builder, and make sure that Hide Bar When Vertically Compact is unchecked ...
ios,objective-c,autolayout,uisegmentedcontrol,uitoolbar
I created a toolbar with a segmented control inside, then made the segmented control 320 wide. I then set flexible layout guides on each side to force the segmented control into the center. This looks fine in portrait, but the segmented control will not stretch out for landscape. Portrait (includes...
ios,objective-c,xcode,file-management
Xcode does not keep the source files, it just points to them. Most likely you are editing a copy Xcode is not using. In Xcode check the location of the file it is using: ...
Instead of returning a CGRectZero view for the footer, simply return nil. - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { return nil; } Also you do not seem to have implemented heightForFooterInSection:section. That should return 0.0. This seems to have come up before and it would seem iOS often pads the bottom...
ios,objective-c,dependency-injection,typhoon
I don't think anything will break if you make your assembly a singleton, but it should never be necessary. Your assemblies contain recipes or blueprints to instantiate objects, and at startup, behind the scenes, all of this information goes into a TyphoonComponentFactory. The assemblies themselves, at this point, have essentially...
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...
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...
@implementation FirstScreen - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self didLoad]; } return self; } -(void) didLoad { f = [[FirstScreen alloc] initWithFrame:CGRectMake(0, 0, self.view.size.width, self.view.size.height)]; [self.view addSubview:f]; } This will be helpfull. Thanks in advanvce for upvoting....
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,objective-c,methods,double,nsdecimalnumber
numberWithDouble: method of NSDecimalNumber returns NSNumber. In your method you want to return decimal so its OK if you allocate a new NSDecimalNumber with the decimal value (amount in your example). May use the following way to get rid of the error: -(NSDecimalNumber *)myMethod { double amount = 42; ......
objective-c,grand-central-dispatch,nsnotificationcenter,nsnotification
Thanks @Sega-Zero for your guidance. Here is the solution I implemented. _operationQueue = [[NSOperationQueue alloc] init]; _semaphore = dispatch_semaphore_create(0); NSOperation *uploadOperation = [NSBlockOperation blockOperationWithBlock:^{ [self doFirstTask]; }]; NSOperation *downloadOperation = [NSBlockOperation blockOperationWithBlock:^{ dispatch_semaphore_wait(_semaphore, DISPATCH_TIME_FOREVER); }]; NSOperation *completionOperation = [NSBlockOperation blockOperationWithBlock:^{ [self doNextMethod]; }]; [completionOperation...
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];...
objective-c,cocoa,nswindow,keywindow
Somewhat predictably this was fixed by swapping the order of the last two lines: [self.previousWindow orderOut:self]; [newWindow makeKeyAndOrderFront:self]; I initially had concerns that doing things in this order in an application where applicationShouldTerminateAfterLastWindowClosed returns YES might cause the application to close prematurely but this does not seem to be the...
Make sure you have added MapKit Framework in your project and try to follow some basic tutorial IOS8 Mapkit tutorial...
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...
ios,objective-c,avfoundation,avcapturesession
Your problem is actually referenced in the Docs, Specifically; If your application is causing samples to be dropped by retaining the provided CMSampleBufferRef objects for too long, but it needs access to the sample data for a long period of time, consider copying the data into a new buffer and...
You need to use NSString method: stringByExpandingTildeInPath to expand the ~ into the full path. NSString *resPath = [@"~/Library/Preferences/" stringByExpandingTildeInPath]; NSLog(@"resPath: %@", resPath); Output: resPath: /Volumes/User/me/Library/Preferences ...
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)....
You also need to match the extra parameters present inside the anchor tag. "<a\\b[^>]*\\bhref=\"(.*?)\"[^>]*>(.*?)</a>" or "<a\\b[^>]*\\bhref=\"([^"]*)\"[^>]*>(.*?)</a>" Then get the strings you want from group index 1 and 2. Your regex matches all the following chars (ie, chars next to href attribute) because it looks for an > symbol just after...
ios,objective-c,cocoa-touch,uiactionsheet,uialertcontroller
Don't attempt to dismiss the alert controller. It will be dismissed for you by the time your alert action's handler is called. Change the "cancel" action to: UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Dismiss" style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) { NSLog(@"asdhfgjk"); }]; ...
How about -searchBarTextDidEndEditing: in UISearchBarDelegate?
ios,objective-c,swift,expression
let myInt = 4 let myFormulaInt = "5 + 4 + myInt * 5" let intElements = ["myInt": myInt] let myResultInt = NSExpression(format: myFormulaInt).expressionValueWithObject(intElements, context: nil).integerValue println(myResultInt) // 29 let myDouble = 2.5 let myFormulaDouble = "5 + 4 + myDouble * 5" let doubleElements = ["myDouble": myDouble] let myResultDouble...
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....
providing an identifier for your observer. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), "observer identifier", ringerSwitched, CFSTR("com.apple.springboard.ringerstate"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately); CFNotificationCenterRemoveEveryObserver(CFNotificationCenterGetDarwinNotifyCenter(), @"observer identifier"); ...
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...
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,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]); ...
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,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"; ...
What you need to do is to put the TableViewController inside UINavigationController so that you can push a new ViewController [self.navigationController pushViewController:prue animated:YES]; That came be done either in the storyboard by adding the NavigationController into the TabViewController and put your ViewController as its root http://www.raywenderlich.com/5138/beginning-storyboards-in-ios-5-part-1 Or in code as...
javascript,objective-c,cryptography,hmac,cryptojs
HMAC-SHA256 sample code: + (NSData *)hmacSha256:(NSData *)dataIn key:(NSData *)key { NSMutableData *macOut = [NSMutableData dataWithLength:CC_SHA256_DIGEST_LENGTH]; CCHmac( kCCHmacAlgSHA256, key.bytes, key.length, dataIn.bytes, dataIn.length, macOut.mutableBytes); return macOut; } Notes: Add Security.framework to the project Common Crypto must be included: #import <CommonCrypto/CommonCrypto.h> This is data in and out, add any conversions to desired representations...
You could use the loadNibNamed:owner:topLevelObjects: method. Here's an example: NSArray *views = nil; [[NSBundle mainBundle] loadNibNamed:@"TestView1" owner:nil topLevelObjects:&views]; [self.view addSubview:[views lastObject]]; The above code will load the top-level contents of the XIB into an array. Per the documentation: Load a nib from this bundle with the specified file name and...
ios,objective-c,grand-central-dispatch,nsurlsession
Yes, NSURLSession does it's work in a background thread. The download ALWAYS takes place on a background thread. You can control whether it's completion methods are executed on a background thread or not by the queue you pass in in the delegateQueue parameter to the init method. If you pass...
ios,objective-c,multithreading,swift,grand-central-dispatch
dispatch_sync will block the caller thread until execution completes, a concurrent queue has multiple threads so it will only block one of those on that queue, the other threads will still execute. Here is what Apple says about this: Submits a block to a dispatch queue for synchronous execution. Unlike...
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...
So the default is that your main application window is an outlet in the app delegate. You should keep MainMenu.xib's owner as the app delegate. A common alternative, if you are creating your own custom window controller, is to create a property in the AppDelegate of type CustomWindowController, then in...
objective-c,animation,blender,scenekit,collada
3DSMax + OpenCollada exporter works great.
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,objective-c,methods,protocols
viewClass.h @protocol ViewClassDelegate -(void)buttonWasClicked:(NSString *)aString; @end viewClass.m [submitButton addTarget:self action:@selector(submitButtonTapped) forControlEvents: UIControlEventTouchUpInside]; - (void)submitButtonTapped { [self.delegate buttonWasClicked:@"this is a string"]; } mainVC.m // Imported and called the delegate in mainVC.h. Then in .m I set the delegate -(void)buttonWasClicked:(NSString *)aString { // aString = this is a string } ...
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...
ios,objective-c,iphone,landscape-portrait
Override didRotateFromInterfaceOrientation method on your ViewController and change the frame of the scrollView. - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; self.menuScrollView.frame=CGRectMake(0,yPosition,width,self.view.frame.size.height); } ...
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...
If you need to match [ and ] you can use matches operator, which uses regular expressions. Example: NSArray *array = @[@"[apple]", @"[boy]", @"[dog]", @"cat"]; NSPredicate *pred = [NSPredicate predicateWithFormat:@"self matches %@", @"\\[dog\\]"]; NSLog(@"%@", [array filteredArrayUsingPredicate:pred]); About your update: predicateWithFormat is not like stringWithFormat, as it does some additional jobs...
It seems the included library are not compiled for i386 (or simulators) so you must run code on real device. See author comment here and here
in the ViewDidAppear: [yourTextField becomeFirstResponder]; ...
Try the method didSelectRowAtIndexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [self performSegueWithIdentifier:@"ShowDetail" sender:tableView]; } If you want to pass a variable or perform an action before it segues, do the following: - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"ShowDetail"]) { //Do something Detail *detailController = (Detail*)segue.destinationViewController; } } If you...
ios,objective-c,audio,core-audio,audiounit
You can (and should) use kAudioUnitProperty_MaximumFramesPerSlice to specify the maximum number of samples per frame, not the preferred number; please refer to Apple's Technical Q&A QA1533 and QA1606. To set the preferred number of samples per frame, use the setPreferredIOBufferDuration:error: method of AVAudioSession. For example, if the sample rate is...
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...
ios,objective-c,iphone,facebook
try this one : FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init]; [login logOut]; ...
ios,objective-c,iphone,avaudioplayer
I'm not sure if I'm interpreting your code correctly, but it looks like you might be instantiating your player every frame with would explain the slowness. You need to set your player up ahead of time. Then on your timer, call updateMeters right before you get averagePowerForChannel. I'm not familiar...
In the button handler method, call: [self.view endEditing:YES]; This will force the keyboard to disappear and whatever the current text field had the focus will resign first responder and the textFieldDidEndEditing: method will be called for it. The above assumes the button handler is in the view controller class. Since...
For the launch .xib you won't be able to change the color programmatically. You can input hex values in the side menu. Click on background color, choose the second object from the left, and you can input hex values along with RGB values. User the color hex website to convert...
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...
objective-c,xcode,pdf,size,bold
Solved it by making a separate method as below (I used + since I have this inside an NSObject and is a class method rather than in a UIViewController): +(void)addText:(NSString*)text withFrame:(CGRect)frame withFont:(UIFont*)font; { [text drawInRect:frame withFont:font]; } Outside the method, declaring inputs and calling it: UIFont *font = [UIFont fontWithName:@Helvetica-Bold"...
The correct modern style is to use ARC (automatic reference counting) in your project, which is the default for new projects (and has been for a few years). Then you do not need to, and are not allowed to, send the release message. The choice of initWithString: vs. stringWithString: makes...
The fact that I wrote that code helps me answering this question but the answer probably only applies to this code. You can easily limit the frequencies you listen to just by trimming that output array to a piece that contains only the range you need. In details: To be...
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,uialertcontroller
Use Recursive Function rather than loop Example var name:[String] = ["abcd","efgh","ijkl","mnop","qrst","uvwx"] self.friendReuqest(name, index: 0) func friendReuqest(name:[String],index:Int) { if index < name.count { let alertController = UIAlertController(title: name[index], message: "Would you like to accept this friend request?", preferredStyle: UIAlertControllerStyle.Alert) let cancelAction: UIAlertAction = UIAlertAction(title: "Dismiss", style: UIAlertActionStyle.Cancel){ (action: UIAlertAction!) -> Void...
ios,objective-c,multithreading,swift,grand-central-dispatch
This will not deadlock since the dispatched block can start running immediately - it's not a serial queue so it doesn't have to wait for the current block to finish. But it's still not a good idea. This will block one thread causing the OS to spin up a new...
ios,objective-c,uiimageview,autolayout
Based on this Stack Overflow answer, we can get the size of a UIImage by accessing its size property. So, from here, the easiest way to proceed is using autolayout. Set up your storyboard or xib with your image view on it. Go ahead and give your image view an...
objective-c,osx,objective-c-runtime
+[NSObject isSubclassOfClass:] is a class method for NSObject and not all classes are subclasses of NSObject. It seems as if you have find private class that is not a subclass of NSObject, so it requires a more delicate handling for checking for inheritance. Try: BOOL isSubclass(Class child, Class parent) {...
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.
You can use an NSPredicate with a regular expression. NSArray *testArray = @[@"SPOT1234", @"SPOT0483", @"SPAT1234", @"spot1234", @"SPOT123", @"SPOT1233232"]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES '^SPOT\\\\d{4}$'"]; NSArray *resultsArray = [testArray filteredArrayUsingPredicate:predicate]; The resultsArray will contain two strings: SPOT1234, SPOT0483...
objective-c,facebook,facebook-sdk-4.0,social-media
I believe you want to FBSDKSharePhotoContent and FBSDKShareDialog. You need to setup your content as a photo(s): UIImage *screengrab = UIGraphicsGetImageFromCurrentImageContext(); FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init]; content.photos = @[[FBSDKSharePhoto photoWithImage:screengrab userGenerated:YES]]; // Assuming self implements <FBSDKSharingDelegate> [FBSDKShareAPI shareWithContent:content delegate:self]; ...
objective-c,nsmutablearray,key-value-observing
The problem was that I was trying to observe an array which was not possible that way.
ios,objective-c,xcode,annotations,mkmapview
What you could do is: A) get the annotations directly: MKMapRect visibleMapRect = mapView.visibleMapRect; NSSet *visibleAnnotations = [mapView annotationsInMapRect:visibleMapRect]; B) Loop through your array and check whether the point is inside: MKMapRect mapRect = mapView.visibleMapRect; for (NSDictionary *item in array) { CLLocation *location = item[@"location"]; // Or what ever you...
ios,objective-c,iphone,nsfilemanager
NSFileCoordinator and NSFilePresenter are created just for that. You may find interesting Advanced iCloud Document Storage video from wwdc that covers the usage of this classes. Building a Document-based App will be great to watch too.
objective-c,iphone,ios8,uinavigationcontroller,autorotate
Just subclass UINavigationController and override appropriate methods: .h File: @interface CustomUINavigationController : UINavigationController @property BOOL canRotate; @end .m File: @implementation CustomUINavigationController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; // Do any...
ios,objective-c,rest,model-view-controller,afnetworking-2
I dont have anything to say about your MVC(Model–view–controller) correct? I just want to add something that may be useful approach avoiding unwanted crashes.. First is under [[MyAPI sharedInstance] POST:@"auth/" parameters:params success:^(NSURLSessionDataTask *task, id responseObject) { if([responseObject objectForKey:@"id"]) { [[NSUserDefaults standardUserDefaults] setObject:(NSDictionary*) responseObject forKey:USER_KEY]; [[NSUserDefaults standardUserDefaults] synchronize]; result = [responseObject...
ios,objective-c,cordova,phonegap-plugins
This solved me issue. It is working fine now after following below steps https://discussions.apple.com/thread/6742087?start=0&tstart=0 To troubleshoot this issue where your iPhone is unresponsive, please follow the steps outlined below: 1. If a single application is not responding or stops responding when it opens, you can force it to close. 2....
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...
ios,objective-c,iphone,swift,parse.com
I suggest to implement a simple beforeSave trigger, on Parse Cloud code, in order to check if the new entry song already exist (basically you're going to make one or more field uniques. For example: Parse.Cloud.beforeSave("Musics", function(request, response) { var newEntrySong = request.object; var querySongs = new Parse.Query("Musics"); querySongs.equalTo("title", newEntrySong.get("title"));...
ios,objective-c,iphone,xcode,uiviewcontroller
in your ClassA.m - (IBAction)button1:(UIButton *)sender{ path=[[NSBundle mainBundle] pathForResource:@"filename" ofType:@"pdf"]; [self performSegueWithIdentifier:@"yourIdentifierName" sender:self]; } - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if([segue.identifier isEqualToString:@"yourIdentifierName"]) { classB *clsB =segue.destinationViewController; clsB.typeofSelect=path; } } in your class B.h @property (nonatomic, weak) NSString *typeofSelect; in your Class B.m @synthesize typeofSelect;...
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,objective-c,uiview,keyboard
Instead of doing this manually. use TPKeyboardAvoidingScrollView. Its easy to use. First take UIScrollView and put ur all views inside it. For use with UITableViewController classes, drop TPKeyboardAvoidingTableView.m and TPKeyboardAvoidingTableView.h into your project, and make your UITableView a TPKeyboardAvoidingTableView in the xib. If you're not using a xib with your...
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....
Create this method: -(void) drawViewsEvery5Seconds { if(!lastView)//should be a member variable { lastView = [[UIView alloc] initWithFrame:CGRectMake(0, 580, 16, 25)]; } else { lastView = [[UIView alloc] initWithFrame:CGRectMake(lastView.frame.origin.x+16, 580, 16, 25)]; } lastView.backgroundColor = [UIColor blackColor]; [self.view addSubview:lastView]; [self performSelector:@selector(drawViewsEvery5Seconds) withObject:nil afterDelay:5]; } and then just call [self drawViewsEvery5Seconds]; UPDATE...
ios,objective-c,uiview,uialertview
Try adding backgroundView into self.view.window, not self.view.
ios,objective-c,storyboard,size-classes
There are two to prevent this problem (1) Load your entire method in -(void)viewDidAppear:(BOOL)animated { } (2) Do the following step Go to file Inspector Uncheck "Use size classed ...
objective-c,cocoa,nstextfield,autoresize,nscursor
Interesting question, I've never applied auto-layout to a text field so I was curious myself. My solution was to listen for the NSWindowDelegate method, -windowDidResize. Upon that, I would check to see if the text field was the first responder. If it was, I set it to be first responder...
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,https,uiimageview,xcode6
Issue resolved by modifying some parameters into the framework for webservice calling created by me. All those changes were as per the server which I was calling to. Thanks...
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:...
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,objective-c,uiview,uiviewcontroller
Really there are only 2 options to display ViewControllerB from ViewControllerA, and which you use will depend on what you want to achieve - Option 1: Modal presentation Use this if ViewControllerB should take focus away from ViewControllerA entirely until it is dismissed. [self presentViewController:viewControllerB animated:YES completion:nil]; There are a...
OK, somehow I found the answer here NSArray containObjects method. According to what they say. The documentation states that the method "containsObject:" is used for comparing the reference of the objects, and not the value itself. No wonder the time when I passed a hardcoded NSString in the for loop,...
ios,objective-c,selector,nstimer
You are failing to track existing timers and are, instead, creating multiple timers, which is why you are getting them firing multiple times. Use instance variables, and only create a timer if it's currently invalid: case blinkingGreen: self.greenLamp = YES; self.yellowLamp = NO; self.redLamp = NO; [self createBlinkingTimer]; break; case...
objective-c,iphone,sprite-kit,skspritenode
Here are some observations: You your code inside of a loop which only runs once. Why are you doing that? If you are creating an object, in your case a SKSpriteNode, and want to delete it later on, you will need to keep some kind of reference to it. There...
ios,objective-c,swrevealviewcontroller
Always perform a segue in the main queue. Your callback is executing in the separate NSOperationQueue, you need to wrap performSegueWithIdentifier in dispatch_async(dispatch_get_main_queue,.... Plus, as @rory-mckinnel mentioned in the comments, remove unnecessary [super viewDidLoad] calls as in may lead to unexpected results....
ios,objective-c,xcode,generics
The lightweight generics introduced in Xcode 7 are just compile time hints to help the compiler raise warnings, but at run time you get the same old behavior with your variable being just NSArrays of ids. Source: WWDC '15 "Swift and Objective-C Interoperability" session See the transcript of the talk:...