我今晚对我的项目进行了一些修改,搞砸了一些东西.有没有办法可以回到我打开它时项目的方式?我添加/删除了一些文件,但我没有看到回去的方法.我上次的机器备份也是几天前的.
我正在使用chcsvparser来解析我的应用程序启动时csv文件中的数据.在主线程上启动时间太长,所以我想在后台线程上执行此操作.但我读到你无法在线程之间传递对象.解析器输出一个NSArray,有没有办法做到这一点?我还读过你不应该从后台线程更改UI,但是这个数组会加载一个表视图.
我试图将UILabel水平放置.这就是最终看起来像(注意它没有中心).

ReflectionView *aReflectionView = [[ReflectionView alloc]initWithFrame:CGRectMake(((self.view.bounds.size.width / 2) - 150), 40, 300, 90)];
UILabel *aLabel = [[UILabel alloc]initWithFrame:CGRectMake(((self.view.bounds.size.width / 2) - 150), 0, 300, 90)];
aLabel.textAlignment = UITextAlignmentCenter;
aLabel.text = @"1 lbs";
self.weightLabel = aLabel;
[aReflectionView addSubview:self.weightLabel];
self.weightReflectionView = aReflectionView;
[self.view addSubview:self.weightReflectionView ];
[self.weightReflectionView updateReflection];
Run Code Online (Sandbox Code Playgroud) 我有一个表,目前可以刷卡删除.我想在导航栏中有一个编辑按钮,以便用户可以更改单元格的标题文本.
到目前为止我有这个但没有任何反应
UIBarButtonItem * editButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(setEditing:animated:)];
[self.navigationItem setLeftBarButtonItem:editButton];
[editButton release];
- (void)setEditing:(BOOL)editing animated:(BOOL)animate
{
[super setEditing:editing animated:animate];
if(editing)
{
NSLog(@"editMode on");
}
else
{
NSLog(@"Done leave editmode");
}
}
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
// Delete the managed object for the given index path
NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
[context deleteObject:[self.fetchedResultsController objectAtIndexPath:indexPath]];
NSLog(@"fetched results : \n%@\n",[self.fetchedResultsController fetchedObjects]);
// Commit the change.
NSError *error = nil;
// Update the array …Run Code Online (Sandbox Code Playgroud) 谁能告诉我这段代码有什么问题?我正在尝试确定哪个方向(纵向或横向,设备所在).谢谢.
- (void)checkOrientation
{
UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
switch (orientation)
{
case UIInterfaceOrientationPortrait:
self.tableView.backgroundColor = [UIColor whiteColor];
break;
case UIInterfaceOrientationPortraitUpsideDown:
self.tableView.backgroundColor = [UIColor whiteColor];
break;
case UIInterfaceOrientationLandscapeLeft:
self.navigationController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background2.png"]];
break;
case UIInterfaceOrientationLandscapeRight:
self.navigationController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background2.png"]];
break;
}
[self.tableView reloadData];
}
Run Code Online (Sandbox Code Playgroud)
从枚举类型'UIDeviceOrientation'到不同枚举类型'UIInterfaceOrientation的隐式转换