Ios 对IQWidgets库有清晰的理解吗
我正在尝试建立一个甘特图。 我在街上找到了这个图书馆 我下载了它,我试着理解如何使用它 我有一个类,可以从服务器中获取数据(JSON)。我将这些结果指定为Ios 对IQWidgets库有清晰的理解吗,ios,objective-c,gantt-chart,Ios,Objective C,Gantt Chart,我正在尝试建立一个甘特图。 我在街上找到了这个图书馆 我下载了它,我试着理解如何使用它 我有一个类,可以从服务器中获取数据(JSON)。我将这些结果指定为[NSDictionary] 我试图使用IQGanttView.h文件,将其添加为当前视图的子视图。 IQGanttView.h有一个名为addRow:(id)row addRow方法有一个参数IQCalendarDataSource,这就是我创建一个类作为IQCalendarDataSource(任务对象)的原因。 我将IQCalendarD
[NSDictionary]
我试图使用IQGanttView.h
文件,将其添加为当前视图的子视图。
IQGanttView.h
有一个名为addRow:(id)row
addRow
方法有一个参数IQCalendarDataSource
,这就是我创建一个类作为IQCalendarDataSource
(任务对象)的原因。
我将IQCalendarDataSource
类更改为具有与任务类相同的属性
创建这些任务对象后,我为所有数组(任务对象)创建了一个for循环,通过addRow:(id)row
方法将它们添加到图表上
我运行代码并遵循它,但它没有在图表上显示任务
我不知道我是否错过了什么?
有人能查一下图书馆,告诉我是否遗漏了什么吗
=================
这是我正在尝试的代码
#import "GanttChartViewController.h"
#import "ASRESTAPI.h"
#import "ASUserSingleton.h"
#import "TasksObj.h"
#import "IQGanttView.h"
// when the view load I want to show the user the loading view until the data is ready to show up on the chart by calling [self setupLoadingIndicator] method
//
- (void)viewDidLoad {
[super viewDidLoad];
tasksItems = [[NSArray alloc] init];
self.ganttView = [[IQGanttView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:self.ganttView];
[self setupLoadingIndicator];
// Do any additional setup after loading the
[self gettheTasksItems];
}
-(void)setupLoadingIndicator
{
loadingView = [[UIView alloc] initWithFrame:CGRectMake(75, 155, 170, 170)];
loadingView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
loadingView.clipsToBounds = YES;
loadingView.layer.cornerRadius = 10.0;
activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
activityView.frame = CGRectMake(65, 40, activityView.bounds.size.width, activityView.bounds.size.height);
[loadingView addSubview:activityView];
loadingLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 115, 130, 22)];
loadingLabel.backgroundColor = [UIColor clearColor];
loadingLabel.textColor = [UIColor whiteColor];
loadingLabel.adjustsFontSizeToFitWidth = YES;
loadingLabel.textAlignment = NSTextAlignmentCenter;
loadingLabel.text = @"Loading...";
[loadingView addSubview:loadingLabel];
[self.ganttView addSubview:loadingView];
[activityView startAnimating];
}
-(void)gettheTasksItems
{
NSString* username = [[ASUserSingleton sharedInstance]userName];
NSString* password = [[ASUserSingleton sharedInstance]password];
_tasks = nil;
[ASRESTAPI tasksListUsername:username andPassword:password completionBlock:^(NSDictionary *response, NSArray *taskArray) {
_tasks = response;
tasksItems = taskArray;
NSMutableArray *tasksObjs = [NSMutableArray array];
int i;
for (i =0; i < tasksItems.count;i++)
{
/*_tasks[@"project"][@"name"]*/ // this is how to call the dictionary object from the array
TasksObj* tasksObj = [[TasksObj alloc]initWithProjectName:tasksItems[i][@"project"][@"name"]
startDate:tasksItems[i][@"start_date"]
dueDate:tasksItems[i][@"due_date"]
estimatedhours:tasksItems[i][@"estimated_hours"]];
//tasksItems[i] objectForKey:@"project"];
[tasksObjs addObject:tasksObj];
}
dispatch_async(dispatch_get_main_queue(), ^{
[activityView stopAnimating];
for (loadingView in [self.ganttView subviews])
{
[loadingView removeFromSuperview];
}
//[loadingView removeFromSuperview];
for (TasksObj* tasksObj in tasksObjs) {
[self.ganttView addRow:tasksObj];
}
});
}];
}
顺便说一下,这是我从服务器获取的JSON数据
"task":
{
"id":1,
"project":{"id":1,"name":"test"},
"tracker":{"id":1,"name":"Bug"},
"status":{"id":1,"name":"New"},
"priority":{"id":4,"name":"Urgent"},
"author":{"id":1,"name":"the user name"},
"subject":"Example",
"description":"",
"start_date":"2016-02-17",
"due_date":"2016-02-23",
"done_ratio":0,
"estimated_hours":3.0,
"spent_hours":0.0,
"created_on":"2016-02-18T04:28:55Z",
"updated_on":"2016-02-22T19:09:22Z"
}
请发布您尝试过的代码。好的,我将编辑我的帖子,以便您可以查看。谢谢你的评论!!真的谢谢你。
"task":
{
"id":1,
"project":{"id":1,"name":"test"},
"tracker":{"id":1,"name":"Bug"},
"status":{"id":1,"name":"New"},
"priority":{"id":4,"name":"Urgent"},
"author":{"id":1,"name":"the user name"},
"subject":"Example",
"description":"",
"start_date":"2016-02-17",
"due_date":"2016-02-23",
"done_ratio":0,
"estimated_hours":3.0,
"spent_hours":0.0,
"created_on":"2016-02-18T04:28:55Z",
"updated_on":"2016-02-22T19:09:22Z"
}