代号如何将组件放置在捕获相机的图像查看器上?

时间:2017-07-02 17:00:03

标签: camera cross-platform codenameone

我有一个以代号为一的GUI Builder创建的表单,如何在表单的show()中以可调整大小的视图打开相机并将容器放置在文本区域或其他任何内容上? 我看到了相机演示,但我不太了解它,因为在模拟器上它打开了一个文件选择器。 我的目的是创建一个带有相机可调整大小捕获的表单,当你有两个标签,你也可以在背景中使用的照片上书写或绘画,我这样做只是为了爱好和乐趣,我尽我所能,任何建议都很好接受了,谢谢你的关注

1 个答案:

答案 0 :(得分:0)

现在,您可以使用新的cn1lib将组件放置在摄像机视图的顶部:https://github.com/codenameone/CameraKitCodenameOne

以下原始答案:

我假设您的意思是在实时摄像机视图上叠加。虽然这是可能的,但目前在Java API层中不支持它。

如果您的意思是抓取照片并将其设置为叠加表单的背景,则可以使用- (void)viewDidLoad { [super viewDidLoad]; [self.navigationItem setTitle:@"List of Items"]; NSURL *serverURL = [NSURL URLWithString:SERVER_URL]; [[DataManager sharedInstance] loadData:serverURL withCompletion:^(NSArray *itemListArray, NSError *error) { if (error != nil) { UIAlertView *errorAlertView = [[UIAlertView alloc] initWithTitle:@"Server Error" message:@"Unable to fetch Data from Server" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil]; [errorAlertView show]; } else { fetchData = [self convertSectionTableData:itemListArray keyString:@"date"]; [self.listTableView reloadData]; } }]; [self.listTableView reloadData];} - (NSMutableDictionary *)convertSectionTableData:(NSArray *)convertDataSet keyString:(NSString *)keyString { NSMutableDictionary *outputData = [NSMutableDictionary dictionary]; NSMutableArray *temp = [NSMutableArray array]; NSString *key = NULL; for (NSDictionary *dic in convertDataSet) { if (key == NULL) { key = [dic objectForKey:keyString]; } else if (key != [dic objectForKey:keyString]) { [outputData setValue:temp forKey:key]; temp = [NSMutableArray array]; key = [dic objectForKey:keyString]; } if ([[dic objectForKey:keyString] isEqualToString: key]) { [temp addObject:dic]; } if (dic == [convertDataSet lastObject]) { [outputData setValue:temp forKey:key]; } } return outputData;} - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return [fetchData count];} -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [[fetchData allValues][section] count];} -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @"CustomListTableCell"; CustomListTableCell *cell = (CustomListTableCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier]; int section = (int)indexPath.section; int row = (int)indexPath.row; NSDictionary *data = [[fetchData allValues][section] objectAtIndex:row]; cell.homeLabel.text = [data objectForKey:@"home"]; return cell;} - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { return [fetchData allKeys][section];} @end API的结果创建图像,并使用setBgImage()将该图像设置为背景组件或形式。

相关问题