开发者

touchesBegan not invoked on iPhone

I am developing a pie chart applica开发者_高级运维tion using Core-Plot on iPhone.

There are no issues in drawing the pie-chart. But I am unable to interact with its slices. I even tried interacting with them using touchesBegan event. But even this method is not getting invoked.

Please help me in this regards. User interaction has been enabled.


Try to implement <CPPiechartDelegate> in your class.

Then implement

-(void)pieChart:(CPPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index
{

// This will inform you the index of the slice that was touched or clicked.

}

Also use latest Coreplot framework as old framework has some issues related to selecting touch event.

Edit

Try This

In yourViewController.h file

#import <UIKit/UIKit.h>
#import "CorePlot-CocoaTouch.h"

@interface yourViewController : UIViewController <CPPieChartDataSource, CPPieChartDelegate> 
{


}

In yourViewController.m file

-(void)pieChart:(CPPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index
{
NSString *selectedIndex = [NSString stringWithFormat:@"Selected index: %lu", index];
NSLog(@"You have selected index=%@",selectedIndex);
}

Finally view your gdb log to get the response ,which index you have selected.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜