I am trying to use Core Plot to draw a graph, but I my graph view is instantiated as a UIView even though I've set it as CPTGraphHostingView in interface builder:
Here is my code:
usersGraph = [[CPTXYGraph alloc] initWithFrame:usersGraphView.frame];
usersGraphView.hostedGraph = usersGraph;
Why would that happen?
After playing on and off in Interface Builder trying everything again and again, I've started to search more on StackOverflow and I've stumbled upon this question: Application crashes when working with core plot
Pretty weird, but it wasn't and IB issue (I was sure I was doing the right thing in IB, I've done it a thousand times before), but a linker issue. I don't know why, but I had to add -ObjC to linker flags, and it worked.
Don't you think that it is strange?
For UIView to have setHostedGraph
-[UIView setHostedGraph:]
I think you have dragged the IBOutlet for that UIView into the custom class file before adding the CPTGraphHostingViewon the identity inspector. Remove the IBOutlet and drag again.
I downloaded the sample project from corePlot. Make sure that the IBOutlet is CPTGraphHostingView.
Related
I tried to find the solution, but I couldn't find anyone with the same problem.
I'm using Xcode 8.2.1, writing in Objective-C.
I'm actually having a problem with adding a UIImageView to IBOutletCollection. I'm trying to do it using the Interface Builder.
dragging to connect ImageView with the Collection
I've already deleted any existing outlets of that ImageView.
I'm also adding screenshot of the header file of the MasterViewController - I guess everything is OK here.
declaration of the collection
Thanks for help.
You have to use IBOutletCollection(UIImageView) instead of IBOutletCollection(UIViewController)
I'm looking for a solution specifically for the issue with a Swift3 UIViewController having IBOutlets defined, but dragging actions from storyboard does not connect them to existing outlets. I can add new outlets, just with different name, and they work (still cant re-connect them later).
I see old solutions for objective-C dealing with headers and source files, but a swift is a single file per class.
Is there a way to fix "can't connect IBOutlet to swift file" issue?
but dragging actions from storyboard does not connect them to existing outlets
I've noticed this too. But it's not a difficult problem. Here's what to do:
Look carefully at the gutter next to the outlet in the code. There is a circle. Drag from that circle (no need for control-drag) to the view in the Interface Builder canvas.
I am trying trying to copy all of the functionality of this example app provided by Apple called AVCam: https://developer.apple.com/library/ios/samplecode/AVCam/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010112-Intro-DontLinkElementID_2
I am 99% done with copying this code, but I just have one final problem. I have an IBOutlet statement that looks like this: #property (nonatomic, weak) IBOutlet MediaCapturePreviewView *previewView;
According to the Apple sample code, this outlet is supposed to be connected to a View object that has been placed on top of the normal/default view.
Here is a screenshot of what the Connections Inspector looks like in the Apple example:
You will notice that the IBOutlet called "previewView" has been connected to something called the "Cam Preview View".
Also, in this screenshot, you can see that I am able to select this View object by itself and that it shows a Referencing Outlet in it's connections inspector for the same IBOutlet and View Object:
My problem is that I cannot get the IBOutlet code to connect to this View Object. I have tried the normal behavior of clicking and dragging to make the connections but it just wants to create a new outlet. It will not let me connect to the outlet that I have already created.
I have been playing with this for 2 hours now and just can't get it to work like Apple's sample code.
Any help is greatly appreciated thank you.
In your .xib file, make sure that UIView class is assigned as AVCamPreviewView instead of UIView.
A few possible solutions:
Save the file with the IBOutlet you're trying to connect up (the source code, not the IB)
Clean, rebuild
Restart Xcode.
(Link to errors here: http://imgur.com/a/AF87N)
I'm starting to work on iOS development, and I'm relatively new.
I was looking for tutorials on how to display web content in the app, and so I used the UIWebView.
In the tutorial I found I followed the steps exactly, but when I went to do the last step (linking the outlet) I got an error.
The two files I edited are DataViewController.h and DataViewController.m
This is the tutorial I followed: http://www.youtube.com/watch?v=NFffF9tRbak
I'm using XCode 4.6
Am I doing something wrong?
Renaming may still cause some erors, there is a chance, so its better to set the connections again.its quite simple.
You can solve this by following these steps:
1.
Click on the cross sign left to Web View , that will remove the invalid outlet.
2.then, connect the existing #property(nonatomic, retain) IBOutlet UIWebView *myWebView by control dragging the '+' sign left to the property outlet to your webview in the Interface Builder.
This will solve your problem, happens just because you are new to xcode. Will get better as soon as you get familiar.
EDIT:If its still not clear, see the screen shots below;
your outlet in yourviewcontroller.h may be like this now,
and in your xib,
it may look like this.
So what you should do is, just control drag the while blank circle left to #property outlet (first image) to the webview in your xib (highlightened one in second image). It will connect itself.
hope its clear now
Regards
Change your outlet name from webView to myWebView in outlets
Edit:
or change your UIWebView object name from myWebView to webView in your code
I'm using XCode 4.6 and I'm trying to replace one of my UITextView's by a SSTextView from SSToolKit in order to add a placeholder to it. The SSToolkit library is correctly integrated in my project thanks to CocoaPods. So I just changed the type of the property in my view controller to be SSTextView instead of UITextView:
#property (strong, nonatomic) IBOutlet SSTextView *commentTextView;
And of course I also changed the class of the control in interface builder's inspector:
And yet, in my controller's viewWillAppear: the property is still a UITextView and when I set the placeholder:
self.commentTextView.placeholder = NSLocalizedString(#"Comment", #"");
I get an "unrecognizable selector setPlaceholder: sent to instance".
It seems to me like I've done that sort of things a thousand times and yet here, I can't figure out what I'm forgetting.
I figured it out. It turns out some parts of the compiled application seem not to be overwritten when redeploying to the simulator. So after I deleted the app from the simulator and ran it from scratch, it worked normally. I had other bugs like missing segues and so on so I looked that up and found out about the "delete app" technique. Weird...