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?
Tag: 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?
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 your colors into RGB values if you want to use the color throughout your app (when you can do things programmatically).
If you have specific and consistent color needs, I would recommend creating custom categories to store your custom colors. An example answer is here.
UIColor+CustomColorCatagory.h
#import <UIKit/UIKit.h>
@interface UIColor (CustomColorCatagory) //This line is one of the most important ones - it tells the complier your extending the normal set of methods on UIColor
+ (UIColor *)customColor;
@end
UIColor+CustomColorCatagory.m
#import "UIColor+CustomColorCatagory.h"
@implementation UIColor (CustomColorCatagory)
+ (UIColor *)customColor {
return [UIColor colorWithRed:0.643 green:0.643 blue:0.643 alpha:1];
}
@end
Hope this helps!
objective-c,animation,blender,scenekit,collada
3DSMax + OpenCollada exporter works great.
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,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...
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. ...
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:...
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,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,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"; ...
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,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,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...
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...
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 ...
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....
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...
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,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...
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,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...
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...
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...
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...
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,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,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....
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...
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...
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...
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,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:)]) { //...
How about -searchBarTextDidEndEditing: in UISearchBarDelegate?
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,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,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...
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,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...
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...
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...
Make sure you have added MapKit Framework in your project and try to follow some basic tutorial IOS8 Mapkit tutorial...
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,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,uiview,uialertview
Try adding backgroundView into self.view.window, not self.view.
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.
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 } ...
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]); ...
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....
Check the Navigation Controller properties in the interface builder, and make sure that Hide Bar When Vertically Compact is unchecked ...
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]; ...
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 ...