ios,xcode,swift,ios8,xcode6.3.2
Change your this line : let originView:UIView! to var originView:UIView! And you are done....
After looking your code, you just save the image in cloud and you neither specify who uploaded it and who can access it(Read and Write Permission is not set). By default, whatever you are storing in parse cloud, the ACL(Access Control List) is Public Read, Write. So, If you want...
c++,xcode,pointers,memory-alignment,type-safety
You are not checking against a pointer, you are checking against a reference. References are not supposed to be nullptr since they must refer to an existing value. Indeed what you are doing *(AStruct*)0 is not well defined since a reference shouldn't be able to generate undefined behaviour through "dereferencing...
The problem is with frame calculation of the mask. Make sure that when some of the layer is a mask then you should calculate the frame of the mask like if it is just a sublayer of the superlayer. In other words, the coordinate system of the mask equals to...
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....
Make sure you've installed the xcode command-line tools: xcode-select --install (Accept the pop-up dialog.) That will install system headers into standard locations expected by tools like gcc, e.g. /usr/include....
ios,iphone,xcode,xcode6,ios-simulator
Create and add a CCSprite: CCSprite *bg = [CCSprite spriteWithFile:@"bg.png"]; bg.tag = 1; bg.anchorPoint = CGPointMake(0, 0); [self addChild:bg]; ...
ios,iphone,xcode,user-interface,customization
I would suggest that you look at targets http://www.itexico.com/blog/bid/99497/iOS-Mobile-Development-Using-Xcode-Targets-to-Reuse-the-Code You could generate your XML file for each "Target", but only include the correct one for each target. Then when the app is compiled it should include all the relevant information. If you are producing multiple apps, you also need to...
I had same problem and I posted detailed question later. Luckily, I figured out the problem and it is working for me now. I was not sending data in proper format that got working after I sent data in proper format. My JSON format looks like this. { "notification":{ "badge":"12",...
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;...
I have used QLPreviewController in one of my projects. I think that is an easiest option to implement. Also I don't know whether it is the solution what you are looking for. I have created it with the following code Class qlookclass = NSClassFromString(@"QLPreviewController"); if(qlookclass){ //check if the image exists...
ios,xcode,swift,autolayout,nslayoutconstraint
"Add Missing Constraints" is not always a good idea to add constraints..rather you should always prefer to add constraints manually... Here is the image for your UI...I used wAnyhAny layout as it is good practice for add constraints for universal devices... I used simply width constraint for textfield, rather you...
You are using class PFLoginview instead of property logInView you can change to logo as below self.logInViewController.logInView.logo = logInLogoTitle ...
I recommend using spring animations if you want a nice animation like this: func buttonTapped(sender: UIButton!) { //or in an IBAction let duration: NSTimeInterval = 0.75 let damping: CGFloat = 1 let velocity: CGFloat = 0.5 UIView.animateWithDuration(duration, delay: 0.5, usingSpringWithDamping: damping, initialSpringVelocity: velocity, options: .CurveLinear, animations: { self.myView.center.y = self.view.frame.height/2...
ios,objective-c,iphone,xcode,uiimagepickercontroller
Please use the following code to select video from iOS gallery UIImagePickerController *videoPicker = [[UIImagePickerController alloc] init]; videoPicker.delegate = self; videoPicker.modalPresentationStyle = UIModalPresentationCurrentContext; videoPicker.mediaTypes =[UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; videoPicker.mediaTypes = @[(NSString*)kUTTypeMovie, (NSString*)kUTTypeAVIMovie, (NSString*)kUTTypeVideo, (NSString*)kUTTypeMPEG4];...
c++,xcode,osx,opencv,opencv3.0
Found a solution to get rid of the crash: use createCGImage:fromRect to skip the NSBitmapImageRef step: - (void)OpenCVdetectSmilesIn:(CIFaceFeature *)faceFeature usingImage:ciFrameImage { CGRect lowerFaceRectFull = faceFeature.bounds; lowerFaceRectFull.size.height *=0.5; CIImage *lowerFaceImageFull = [ciFrameImage imageByCroppingToRect:lowerFaceRectFull]; // Create the context and instruct CoreImage to draw the output image recipe into a CGImage if( self.context...
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: ...
Xcode's code completion and related tools work from knowledge of the compile-time and run-time environment of your code... that knowledge is supplied by the compiler. Xcode doesn't know what a compiler is doing with any given file unless Xcode is the one telling the compiler what to do with that...
ios,xcode,swift,core-data,uisearchcontroller
I found a solve, I changed my UITableViewController class FirstTableViewController: UITableViewController, NSFetchedResultsControllerDelegate, UITableViewDataSource, UITableViewDelegate, UISearchControllerDelegate, UISearchResultsUpdating, UISearchBarDelegate { @IBAction func addNew(sender: UIBarButtonItem) { } let managedObjectContext: NSManagedObjectContext? = (UIApplication.sharedApplication().delegate as? AppDelegate)?.managedObjectContext var fetchedResultsController: NSFetchedResultsController? // MARK: - setting for search...
Some devices not recording sound correctly, but it is workng on simulator not working on real devices, check your code first then try again
ios,xcode,swift,particles,skemitternode
The solution was setting the advanceSimulationTime to exactly 1.0 sec. I'm not entirely sure why this is the case, but I suppose that the creation "animation" takes up this time. Anyway, case closed and thanks for the help to everyone, especially lchamp since he suggested the solution....
I have created a new extension to output the offset components as string for you: import UIKit extension NSDate { func yearsFrom(date:NSDate) -> Int{ return NSCalendar.currentCalendar().components(.CalendarUnitYear, fromDate: date, toDate: self, options: nil).year } func monthsFrom(date:NSDate) -> Int{ return NSCalendar.currentCalendar().components(.CalendarUnitMonth, fromDate: date, toDate: self, options: nil).month } func weeksFrom(date:NSDate) -> Int{...
For the moment, there's no easy way to do this, since as you said, 10.9 is the farthest back you can specify. Until Xcode 7 is released, which I believe will only help with more recent SDKs anyway, you have few choices, none at all convenient: Keep a cheap Mac...
ios,objective-c,iphone,xcode,testing
These are called Unit Tests and you can test your components, like classes and functions, with them. You write a Test and if you change something on your classes, the test will show you if the class still works as expected. For an example: http://www.preeminent.org/steve/iOSTutorials/XCTest/ You should also read a...
All you have to do is Set the label ":" in centre vertical and horizontally and align all the constraints according to it . align the blue view giving it top , height , width and centre X to the label ":" and all other views giving them top and...
Try this : if count(password) < 5 { ... } ...
The problem is here, you are declaring record as a String, previously it was NSDictionary and due to scope the record in record["record_id"] is String not NSDictionary. Quick fix is to change the name as I did let time: String = record["time"] as! String let record1: String = record["record"] as!...
xcode,swift,if-statement,conditional,percentage
You can use arc4random_uniform to create a read only computed property to generate a random number and return a boolean value based on its result. If the number generated it is equal to 1 it will return true, if it is equal to 0 it will return false. Combined with...
As of Swift 2, you can't simply loop over a String to enumerate the characters anymore, now you have to call the characters method on the String itself: for letter in "hello".characters { print(letter) } So for you, given that objectAttributeValues[countOfRun] seems to return a String, that would be: for...
ios,arrays,xcode,parse.com,labels
Yup pretty simple. I would look into Relations. See their guide here But if you want it as an array for that user here is how you would do that: https://parse.com/docs/ios/guide#relations-using-an-array Copy/Paste: OBJ C // let's say we have an author PFObject *author = ... // and let's also say...
You should sign your application with an Ad-hoc profile, not the developer and not the AppStore one. To make sure it is about provision or certificate signing, with your device connected to computer, in XCode, open device manager and see log while you are trying to install app via Testflight.
I had to navigate to ~/Library/Developer/Xcode/Archives/(DateOfArchive) Then clicked Show Package Contents of the archive Then Products/Applications Show Package Contents of the Application Then I deleted the WatchKitStub folder
As Martin says in his comment, timers have a resolution of 50-100 ms (0.02 to 0.1 seconds). Trying to run a timer with an interval shorter than that will not give reliable results. Also, timers are not realtime. They depend on the run loop they are attached to, and if...
ios,xcode,swift,button,uiviewcontroller
Follow these steps... 1: Create a Separate file called Manager.swift and place this code in it... //manager.swift import Foundation struct Manager { static var messageText = [String]() } 2: Clean your project by pressing Shift+Command+K. 3: In the first view controller set the messageText to the text fields text... Manager.messageText.append(self.textField.text)...
xcode,storyboard,retina-display
I am using Xcode 6.3.1. You should use Images.xcassets found in the File Manager. You then drag and drop the images from the File Manger into the left hand pane of the Images.xcassets. It will create a new xcasset with the same name minus the @#x.png. You then drag the...
You check for a tie after checking every combination. This works if it isn't the last move because your tie condition (all spaces filled) will be false. But, when all spaces filled you are doing "is combo 0 a win"? NO, "are all spaces filled?" YES, a tie, "is combo...
Why not save a button state in a global variable, so you can do what you want? Here is a quick example: (you can chance the title of the button here too) var buttonState:Int = 0; // func for buttonpress @IBAction func startButtonClicked(sender: UIButton) { switch(buttonState) { case 0: //...
ios,xcode,xcode7,ios9,asset-catalog
I think its not possible to use Asset Catalog for video stuff, Its simplify management of images. Apple Documentation Use asset catalogs to simplify management of images that are used by your app as part of its user interface. An asset catalog can include: Image sets: Used for most types...
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 ...
Thats because your slider.value returns a Float. You are trying to convert the result of it but you need to convert just the slider.value to Int to multiply it by numbers which is an Int. Try like this: Note: As mentioned by Josh you need also to unwrap toInt() optional...
ios,xcode,scroll,uiwebview,swipe
This is how I implemented swipe gesture in UIWebView. Add <UIGestureRecognizerDelegate> protocol to ViewController.h In ViewDidLoad Method add the following code: UISwipeGestureRecognizer * swipeGestureDown = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeDown)]; swipeGestureDown.numberOfTouchesRequired = 1; swipeGestureDown.direction = UISwipeGestureRecognizerDirectionDown; swipeGestureDown.delegate = self; [self.webView addGestureRecognizer:swipeGestureDown]; Add Delegate method in ViewController.m :...
Just to answer your last question as to how to generate random numbers ranging from 1 to 10 (instead of 0 to 10): int i = arc4random_uniform(9)+1; ...
ios,xcode,swift,uitableview,overlap
I can fix the problem. In the storyboard, the label have unchacked "Clears Graphics Context". I checked and for now it solved! Thanks for the help!
ios,xcode,swift,uigesturerecognizer
You can get a reference to the view the gesture is added to via its view property. In this case you are adding it to the button so the view property would return you you the button. let button = sender.view as? UIButton ...
objective-c,xcode,ios7,uiviewcontroller,collectionview
if you looks closer to you code you found this line -(void) collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath { Some time ago I have the same mistake with this method didDeselectItemAtIndexPath of course we want didSelectItemAtIndexPath instead...
Yes you will have to check the using encryption box, you are using encryption.
ios,xcode,apple-watch,watch-os
Seems to be working now. Submission just gives a warning but the binary goes up fine and can be submitted.
As mentioned in Using Swift with Cocoa and Objective-C, all Objective-C methods that use NSError to return an error object will now throw when called from Swift 2.0, so you need to use: do { try method() } catch let error as NSError { reportError(error) } Removing the reference to...
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"...
ios,xcode,swift,uiviewcontroller
There is no property allValues in self You probably meant CardType.allValues. Something like this: func from(cardNumber: String) -> CardType { for type in CardType.allValues { if type.isValidFor(cardNumber) { return type } } return CardType.None } ...
After checking several options, I have decided to use xctool because this is a recommended tool when the tests have been done using KIF. At the beginning I had some trouble trying to run the test, but after reading other posts I have use the following commands: For running all...
objective-c,xcode,osx,cocoa,cocoa-touch
CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.colors = [NSArray arrayWithObjects:(id)[[NSColor whiteColor] CGColor], (id)[[NSColor greenColor] CGColor], nil]; gradient.frame = self.colorView.bounds; [self.colorView setLayer:gradient]; [self.colorView setWantsLayer:YES]; ...
Close any projects or workspace windows you have open in Xcode but leave Organizer window open and re-submit worked for me.
If you installed iOS 9 beta onto your iPhone, then you cannot develop on it without Xcode 7. However, this is not a completely terrible thing; you can readily have both Xcode 7 and Xcode 6 on the same computer. What you cannot do is revert your iPhone back to...
You library was compiled without bitcode but the bitcode option is enabled in your project settings. Say NO to Enable Bitcode in your target Build Settings and the Library Build Settings to remove the warnings. ...
If Paul moves his comment to an answer I'll delete mine and upvote his. Here was a screenshot I was preparing when he got his comment in: You want the "show" issue navigator item checked to on....
Auto layout is messing with it. In Interface Builder, set the label's vertical content compression resistance priority to 1000.
Well I've figured out both of my issues. 1) In the external build tool configuration I had to uncheck 'Pass build settings in environment'. 2) I'm a bit of an idiot here...I'd tried adding -g to my $(FLAGS) variable, but realized that was only applying to my executable. I modified...
ios,objective-c,xcode,autolayout
I came up with a solution. Set "Lines" to 2 Set "Line Breaks" to "Truncate Tail" Set "Autoshrink" to "Minimum Font Scale" and set the value to 0.1 (or however small you want it to be) (Optional) Check "Tighten Letter Spacing" The next part was in code. I subclassed UILabel...
Your custom initializer cannot initialize the immutable property. If you want it to be immutable then, instead of creating a custom initializer, just initialize in one of the required or designated initializer. Like this, class AddBook: UIViewController { @IBOutlet weak var bookAuthor: UITextField! @IBOutlet weak var bookTitle: UITextField! let bookStore:...
ios,iphone,xcode,storyboard,autolayout
Just give top, left , right, height and equal width constraints to all label.... ...
NSNumber is a class; NSInteger is just a typedef of long, which is a primitive type. dic[@"count"] is a pointer, which means that dic[@"count"] holds an address that points to the NSNumber instance. NSNumber has a method called integerValue which returns an NSInteger as the underlying value that the NSNumber...
first of all you need to create IBOutlet of both UISwitch in your header .h file @property (strong, nonatomic) IBOutlet UISwitch *isMale; @property (strong, nonatomic) IBOutlet UISwitch *isFemale; then in your IBAction do as follow. - (IBAction)isMale:(id)sender { if ([sender isOn]) { [_isFemale setOn:NO animated:YES]; } else { // do...
You'll get that error message in Xcode 7 (Swift 2) if a subclass declares conformance to a protocol which is already inherited from a superclass. Example: class MyClass : CustomStringConvertible { var description: String { return "MyClass" } } class Subclass : MyClass, CustomStringConvertible { override var description: String {...
Because of the blurring effect on a translucent UINavigationBar, the color you set is not exactly how it will be displayed on screen. You can either set your navigation bar's translucent property to NO: self.navigationController.navigationBar.translucent = NO; ... or use this handy calculator to work out the correct input color...
Here is explanation: What is an "unwrapped value" in Swift? PFFacebookUtils.logInWithPermissions(["public_profile", "user_about_me", "user_birthday"], block: { user, error in if user == nil { println("the user canceled fb login") //add uialert return } //new user else if user!.isNew { println("user singed up through FB") //get information from fb then save to...
Yeah, simply add any code to the init method: @implementation PDFCreator - (instancetype)init { self = [super init]; if (self) { _someInstanceVariable = @"Hello"; _anotherInstanceVariable = 12; } return self; } This assumes your @interface PDFCreator looks something like this: @interface PDFCreator : NSObject @property NSString *someInstanceVariable; @property (assign) int...
You can convert your Int to Double and use String(format:) method to format your string as desired: stoptimer.text = String(format: "%.2f", Double(arc4random_uniform(5)+1)) ...
ios,xcode,frameworks,transfer,projects
Try transferring everything from plists to the storyboard. I did this with a friend of mine and it only took about 20 minutes for the code to build and run successfully on his own laptop. the biggest issue is going to be transferring the files that Xcode is going to...
Frameworks and libraries are written in such a way that owner does not want you to see how is it implemented or update the code. You can look in to this code http://www.raywenderlich.com/65964/create-a-framework-for-ios where in which how to create framework is mentioned. While creating the framework or library you would...
ios,json,xcode,foundation,swift2
I would expect it to work in the terminal, since what you're seeing here is likely not a bug in Swift or Cocoa Touch, but the side effects of a new feature in iOS 9 called App Transport Security. What this means is that by default, iOS will not permit...
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...
I've fix my problem. I've originally put the line of code bellow on the viewDidLoad() of my controller : tabBarController.selectedViewController = mySecondViewController After moving this line in a different methode, call by a simple button, that worked......
Are you importing the AWS Mobile SDK for iOS using both the frameworks and CocoaPods? You cannot import the SDK twice, and that is why you are getting duplicate symbols errors. You need to pick one of them and remove the other one to remove the errors.
The completion handler is not an optional. You need to pass something. You can pass an empty closure: sprite.runAction(moveToAction, completion: {}) Or, as matt points out, the better approach is to use the other form: sprite.runAction(moveToAction) Matt's answer is really the better one....
let button = UIButton() button.setImage(UIImage(named: "myImage.png"), forState: UIControlState.Normal) button.addTarget(self, action: Selector("myFuncName"), forControlEvents: UIControlEvents.TouchUpInside) ...
First: self.view do not have the toolbar, you have to move your toolbar separately.. Second: self.navigationController.toolbar = CGRectMake.. this is wrong, self.navigationController.toolbar.frame = CGRectMake.. is the correct way. Third: Using self.navigationController.toolbar.frame.origin.y - keyboardFrame.size.height +self.navigationController.toolbar.frame.size.height i think you have to correctly calculate the frame of the self.navigationController.toolbar based from the height...
The problem there is that you should be passing a path to the file but you passed the path to the directory. Try like this: NSFileManager.defaultManager().copyItemAtPath(pathToBundledDB!, toPath: path, error: &error) ...
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:...
xcode,string,swift,string-formatting
As you can see in the documentation: String literals can include the following special characters: The escaped special characters \0 (null character), \ (backslash), \t (horizontal tab), \n (line feed), \r (carriage return), \" (double quote) and \' (single quote) (snip) let wiseWords = "\"Imagination is more important than knowledge\"...
ios,xcode,osx,xcode6,cocoapods
First of all check you have to install command line or not. You can check this by opening Xcode, navigating the menu to Xcode > Preferences > Downloads > Components, finding Command Line Tools and select install/update. if you haven't find command line tool then you need to write this...
After reading several posts at stackoverflow and several post at Github, I found this one where I found a solution at the end. Therefore, my solution was: xctool/xctool.sh -workspace Supermaxi.xcworkspace -scheme Supermaxi build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO It worked for me....
Problem Solved. The way i did it was that i moved my button with 0 tag after my board.
When writing something like Type func() { ... } The compiler expect you to return an object of type Type in every paths of the function, which is not what you do here. Or your LOG function return an A object, which I doubt, and you should write return LOG(),...
ios,database,xcode,sqlite,swift
First add libsqlite3.dylib to your Xcode project (in project settings/Build Phases/Link Binary with Libraries), then use something like fmdb, it makes dealing with SQLite a lot easier. It's written in Objective-C but can be used in a Swift project, too. Then you could write a DatabaseManager class, for example... import...
You can do it as follows. @IBAction func startstop(sender: AnyObject) { if !timer.valid{ let aSelector : Selector = "updateTime" timer = NSTimer.scheduledTimerWithTimeInterval(0.01, target: self, selector: aSelector, userInfo: nil, repeats: true) startTime = NSDate.timeIntervalSinceReferenceDate() } else{ timer.invalidate() } } Else you can take one flag as boolean. You can check by...
ios,xcode,swift,uitableview,tableviewcell
Because you are using reusable cells when you try to select a cell that is not in the screen anymore the app will crash as the cell is no long exist in memory, try this: if let lastCell = self.diceFaceTable.cellForRowAtIndexPath(lastIndexPath) as! TableViewCell{ lastCell.checkImg.image = UIImage(named: "uncheck") } //update the data...
xcode,git,crashlytics,fabric-twitter
That's weird. Usually Xcode automatically adds all changed/new files to the commit automatically, and you can check any files you want in the left side of the window. Regardless, you should be able to cd into the root directory of the Xcode project using Terminal and run git commands, like...
Just add this condition into displayHistory() method : if history.text == "0" { history.text = historyLabel }else { history.text = historyLabel + history.text! } ...
That's not how Codename One works. JSP code will run on the server unrelated to Codename One, the xcode project won't work with Codename One. You will need to write the mobile code from scratch....
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...
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"; ...