DrawRect in CPLayerHostingView? - iphone

0
Hi, i am using Core-plot . but when i declare the normal UIView as CPLayerHostingView,how can i handle drawRect of that view , i cant give another custom UIview name and write code in drawRect of that view?please any help to handle drawRect of CPLayerHostingView?

Put the CPLayerHostingView inside another UIView. The background from your custom UIView will show through if you use transparent fills in the graph.

Put the CPLayerHostingView inside another UIView. The background from your custom UIView will show through if you use transparent fills in the graph.
i did this but i get on exception like this Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setHostedLayer:]: unrecognized selector sent to instance 0x5d20910'

Related

UIImageView-TableViewCell Crash iphone

I am getting a crash while adding uiimageView in a containerView inside uitableView. I am performing lazy loading, the images loads successfully but when i scroll the table upwards, application crashes, Please guide me what i am doing wrong.
'NSInvalidArgumentException', reason: '-[UIImage superview]: unrecognized selector sent to instance
Thanks
Somewhere you're using UIImage where it should be UIImageView.

Gesture recognizer in Interface builder crashes my app

I'm trying to make a gesture recognizer in my app with Interface Builder.
I drag and drop my gesture on my view (it is a UIView which contains UILabel, UIImage and UITextView, all made in Interface Builder).
But when I compile and run, my app crashes and I get the following error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString setView:]: unrecognized selector sent to instance 0x80a5fd0'
I don't understand the reason.
Can someone help me?

How to use captured photo?

I have the camera working in my app, but after the picture is captured and I select use, the app crashes.
How can I connect this use button and make it set a UIImageView I have created to the captured image?
EDIT
Camera is available and ready
Using two-stage rotation animation.
To use the smoother single-stage animation, this application must remove two-stage method
implementations.
Using two-stage rotation animation is not supported when rotating more than one view
controller or view controllers not the window delegate
*** ERROR: FigCreateCGImageFromJPEG returned -12905. Input (null) was 658522 bytes.
Received memory warning. Level=1
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'+[NSInvocation invocationWithMethodSignature:]: method signature argument cannot be nil'
Thanks
Take a look at Apple's PhotoPicker sample project. From the description:
The chosen image or camera photo is
displayed in a UIImageView.

Connection fault in IB

I have a Tab Bar application with four new headers, implementation and interface files, and added those as the sources in IB. They were in this format: FirstView.h/m/xib, SecondView.h/m/xib.
I then had files for First-, Second-, Third- and FourthView.
There was also a file there called FirstViewController. I did not touch this, I just deleted it because I wasn't going to need it.
I then laid out my interface for the first view (FirstView.h/m/xib) in IB. It had an image on the top, label under and a UITableView under that.
I sat up the correct connections (delegations and datasource for the tableview) in my FirstView.h/m file, and pressed Build. It seemed to build without errors, so I pressed Build and Go.
The Simulator popped up, installed the app and crashed. (Error message:Terminating app due to uncaught exception).
Complete error message:
2010-02-06 21:50:54.733 Mudo[52439:207] *** -[FirstViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x39101a0
2010-02-06 21:50:54.735 Mudo[52439:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[FirstViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x39101a0'
2010-02-06 21:50:54.736 Mudo[52439:207] Stack: (**LotsOfNumbers**)
I asked about this in another question, got an answer, and that fixed it:
It was obviously looking for code in the FirstViewController.h/m-file, although I did not do anything to make it look for code there.
I fixed this by adding two interfaces and implementations in my FirstView.h/m file. (FirstView and FirstViewController)
When I ran the app then, the table view and tab bar came up on the screen, but my image and label did NOT.
I don't have any idea of why it was looking for the code in FirstViewController instead of FirstView... I have the correct connections in IB, too..
A tableview is trying to query its data source for the number of rows it should display. If you've connected the tableview's datasource outlet to an instance of your FirstViewController class, then you need to implement -tableView:numberOfRowsInSection: in that class.

What is the difference between setting the delegate in Interface Builder vs using setDelegate:?

I'm trying to set the delegate for a scroll view using Interface Builder.
If I have code like this:
MyScrollViewDelegate * delegate = [[MyScrollViewDelegate alloc] init];
[scrollView setDelegate:delegate];
in viewDidLoad, everything works perfectly.
If I open Interface Builder, add an NSObject and set the class to MyScrollViewDelegate, then link the scrollView's delegate to my instance of MyScrollViewDelegate and inspect [scrollView delegate] inside viewDidLoad, it looks like an instance of MyScrollViewDelegate, and I can interact with it, set proprerties etc, looks good.
However, when I scroll inside the scroll view I get an NSInvalidArgumentException:
*** -[NSCFArray scrollViewDidScroll:]: unrecognized selector sent to instance 0x3d319a0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFArray scrollViewDidScroll:]: unrecognized selector sent to instance 0x3d319a0'
So, questions:
What is the difference between setting the delegate in Interface Builder vs using setDelegate:?
Why is "[NSCFArray scrollViewDidScroll:]" in the console, not, [MyScrollViewDelegate scrollViewDidScroll:]?
What could I be doing wrong?
There is no difference in setDelegate: itself.
However, you have a memory management issue. The problem is that objects don't retain their delegates (to avoid reference cycles). Your delegate is getting deallocated, and the memory is reused for an array. This is why you see a message intended for your delegate getting dispatched to an array.
You are seeing a difference because of an oddity of Interface Builder memory management. The "top-level objects", those objects that appear alongside File's Owner and Main Menu at the top level in the IB doc window, have an unbalanced retain on them. That's keeping your delegate alive in the IB case.
The solution is for something, perhaps your app delegate, to retain the scroll view delegate.
See Memory Management of Nib Objects.