我有下面的代码来显示带有tableview的popover,它完美地运行.
tableview显示13个数字,我可以滚动并看到相同的但是当我在模拟器上发布鼠标触摸时它会回到顶部.
它不会停留在显示它的行,但会将我带回第1到第10行.
滚动后如何使其保持在位置.或者以下代码中的任何修复.
提前致谢.
- (IBAction)btn:(id)sender {
if([popoverController isPopoverVisible])
{
[popoverController dismissPopoverAnimated:YES];
return;
}
//build our custom popover view
UIViewController* popoverContent = [[UIViewController alloc]init];
UIView* popoverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 680)];
popoverView.backgroundColor = [UIColor blackColor];
numbers = [[NSMutableArray alloc] initWithObjects:@"1",@"2", @"3",@"4",@"5", @"6",@"7", @"8", @"9",@"10",@"11", @"12",@"13",nil];
UITableView *tblViewMenu = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 320, 680)];
tblViewMenu.delegate = self;
tblViewMenu.dataSource = self;
tblViewMenu.rowHeight = 32;
[popoverView addSubview:tblViewMenu];
popoverContent.view = popoverView;
popoverContent.contentSizeForViewInPopover = CGSizeMake(320, 320);
popoverController = [[UIPopoverController alloc]
initWithContentViewController:popoverContent];
[popoverController …Run Code Online (Sandbox Code Playgroud) 我已经附加了我正在使用的整个代码,但是没有生成x轴标签.我不知道哪里出错了.我是核心情节中的菜鸟.请帮我解决.谢谢你,快乐新人年.
#import "BarPlotViewController.h"
@interface BarPlotViewController ()
@end
@implementation BarPlotViewController
#define BAR_POSITION @"POSITION"
#define BAR_HEIGHT @"HEIGHT"
#define COLOR @"COLOR"
#define CATEGORY @"CATEGORY"
#define AXIS_START 0
#define AXIS_END 50
//
@synthesize data;
@synthesize graph;
@synthesize hostingView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.data = [NSMutableArray array];
int bar_heights[] = {20,30,10,40};
UIColor *colors[] = {
[UIColor redColor],
[UIColor blueColor],
[UIColor orangeColor],
[UIColor purpleColor]};
NSString *categories[] = {@"Plain Milk", @"Milk + Caramel", @"White", @"Dark"};
for (int …Run Code Online (Sandbox Code Playgroud) 我从Github下载了这段代码:https://github.com/gilthonweapps/CorePlotBarChartExample. 如何选择onTap for bar?我使用以下代码:
#pragma mark - CPTBarPlotDelegate methods
-(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index {
NSLog(@"barWasSelectedAtRecordIndex %d", index);
}
Run Code Online (Sandbox Code Playgroud)
但这不起作用(它没有认识到Tap).请帮助.谢谢你提前和新年快乐.
我拖动了+在Story板上删除了一个barButtonItem并且一直使用这个popover代码但是
[popoverController presentPopoverFromRect:self.barButonItem.frame
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
Run Code Online (Sandbox Code Playgroud)
barButtonItem.frame不起作用,因为没有可用的框架属性.
让它完美运作的最佳选择是什么?
提前致谢.
目前我正在使用此代码:我正在使用此方法:
- (IBAction)buttonClicked:(UIBarButtonItem *)sender event:(UIEvent *)event
{
UIView *viewt = [[UIView alloc] init];
for(UITouch* touch in [event allTouches] )
{
if( [touch phase] == UITouchPhaseEnded )
{
viewt = [touch view];
}
}
}
Run Code Online (Sandbox Code Playgroud)
self.barButtonItem.frame将成为viewt.frame.
它现在工作.这是对的吗 ?
//create a popover controller with my DatePickerViewController in it
UIViewController* popoverContent = [[UIViewController alloc] init]; //ViewController
UIView *popoverView = [[UIView alloc] init]; //view
popoverView.backgroundColor = [UIColor blackColor];
datePicker=[[UIDatePicker alloc]init];//Date picker
datePicker.frame=CGRectMake(0,44,320, …Run Code Online (Sandbox Code Playgroud) 我无法通过ftp从我在cpanel中创建的用户访问文件,但我可以访问托管帐户创建的帐户.我使用ftpes://后跟域名.我收到以下错误:
530 Login authentication failed
Error: Critical error
Error: Could not connect to server
Run Code Online (Sandbox Code Playgroud)
我想创建一个用户,以便他可以在子文件夹(文件夹名为网站)中进行更改,这是为用户配置的路径,而不是public-html.我是ftp的菜鸟,非常感谢任何帮助.谢谢.
我正在使用此链接中的代码.目前如果我有50 bar柱或150 bar柱,那么下面的标签是压缩的,我想在x轴上进行水平滚动而不是压缩x轴.
我试过这个:
plotSpace.xRange = CPTPlotRangeplotRangeWithLocation:CPTDecimalFromInt(-1)length:CPTDecimalFromInt(50)];
Run Code Online (Sandbox Code Playgroud)
从文件中附加代码:
#import "GraphView.h"
@implementation GraphView
- (void)generateData
{
NSMutableDictionary *dataTemp = [[NSMutableDictionary alloc] init];
//Array containing all the dates that will be displayed on the X axis
dates = [NSArray arrayWithObjects:@"2012-05-01", @"2012-05-02", @"2012-05-03",
@"2012-05-04", @"2012-05-05", @"2012-05-06", @"2012-05-07", nil];
//Dictionary containing the name of the two sets and their associated color
//used for the demo
sets = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor blueColor], @"Plot 1",
[UIColor redColor], @"Plot 2",
[UIColor greenColor], @"Plot 3", nil];
//Generate …Run Code Online (Sandbox Code Playgroud)