小编Rui*_*pes的帖子

如何在UITableView中添加页脚?

我使用此代码向TableView添加页脚.它有20个部分,每个部分有几行.有一个titleForHeaderInSection和sectionForSectionIndexTitle方法.

CGRect footerRect = CGRectMake(0, 0, 320, 40);
UILabel *tableFooter = [[UILabel alloc] initWithFrame:footerRect];
tableFooter.textColor = [UIColor blueColor];
tableFooter.backgroundColor = [self.theTable backgroundColor];
tableFooter.opaque = YES;
tableFooter.font = [UIFont boldSystemFontOfSize:15];
tableFooter.text = @"test";
self.theTable.tableFooterView = tableFooter;
[tableFooter release];
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

谢谢,

RL

iphone footer uitableview uiview

56
推荐指数
7
解决办法
11万
查看次数

核心数据和线程/ Grand Central Dispatch

我是Grand Central Dispatch(GCD)和Core Data的初学者,我需要你的帮助来使用带有CGD的Core Data,这样当我向Core Data添加40.000条记录时,UI不会被锁定.

我知道CD不是线程安全的,所以我必须使用另一个上下文,然后保存数据和合并上下文,就我从一些文章中能够理解的那样.

我还做不到的是把各个部分放在一起.

所以,在我的代码中,我需要你的帮助,如何做到这一点.

我有:

/*some other code*/

for (NSDictionary *memberData in arrayWithResult) {

    //get the Activities for this member
    NSArray *arrayWithMemberActivities = [activitiesDict objectForKey:[memberData objectForKey:@"MemberID"]];

    //create the Member, with the NSSet of Activities
    [Members createMemberWithDataFromServer:memberData
                         andActivitiesArray:arrayWithMemberActivities
                              andStaffArray:nil
                           andContactsArray:nil
                     inManagedObjectContext:self.managedObjectContext];
}
Run Code Online (Sandbox Code Playgroud)

如何将其转换为在后台工作,然后,在完成保存后,保存数据并更新UI,而不会在保存40.000对象时阻止UI?

iphone multithreading core-data grand-central-dispatch ios

40
推荐指数
2
解决办法
1万
查看次数

在Xcode 4中本地化iPhone App名称

当我选择Info.plist文件以便可以本地化App名称并尝试构建项目时,构建失败并显示错误,指出无法找到Info.plist文件.

如果我将Info.plist文件路径更改为PROJECTNAME/en.lproj/Info.plist它build,但App的名称未本地化; 如果我在Portugues iPhone上运行它有英文名称.

为什么?

谢谢,

RL

iphone localization

25
推荐指数
1
解决办法
9002
查看次数

默认UITableViewCellStyleSubtitle字体大小?

textLabel和detailTextLabel的默认字体大小是多少?

iphone uitableview

23
推荐指数
3
解决办法
1万
查看次数

NSString - 如何从"ÁlgeBra"走向"代数"

有没有人知道锄头将"ÁlgeBra"这样的NSString改为"代数",没有重音,只有首字母大写?

谢谢,

RL

iphone compare nsstring

23
推荐指数
2
解决办法
5176
查看次数

适用于iOS的PayPal API - 允许吗?

Apple可以在iOS应用程序中使用PayPal API来销售商品和服务吗?

有经验吗?我一直在阅读InApp购买,它仅适用于数字内容.

iphone paypal

11
推荐指数
1
解决办法
1万
查看次数

编辑模式下的UITableView - "编辑"按钮不会改变状态

我有一个带有tableView的UIViewController类.在viewDidLoad中:

UIBarButtonItem *editIcon = [[[UIBarButtonItem alloc]
initWithBarButtonSystemItem: UIBarButtonSystemItemEdit
                    target:self
                    action:@selector(toggleEditMode)] autorelease];
Run Code Online (Sandbox Code Playgroud)

在te方法'toggleEditMode'中:

-(void)toggleEditMode{
if(self.theTable.editing) {
    [theTable setEditing:NO animated:YES];
    [self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStylePlain];
}
else if ([callsArray count]!=0){
    [theTable setEditing:YES animated:YES];
    [self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStyleDone];
}
Run Code Online (Sandbox Code Playgroud)

}

问题是编辑按钮不会改变'完成'.少了什么东西?我声明了所有方法:

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)

谢谢,

RL

iphone editmode uitableview

11
推荐指数
1
解决办法
1万
查看次数

具有不同属性的NSFetchRequest

我试图从NSPredicate获得一个明显的结果.

我的代码:

    NSFetchRequest *request = [[NSFetchRequest alloc] init];
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"Members" inManagedObjectContext:context];
    request.entity = entity;
    request.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"city"
                                                                                     ascending:YES
                                                                                      selector:@selector(caseInsensitiveCompare:)]];

    request.predicate = [NSPredicate predicateWithFormat:@"memberDeleted == %@", [NSNumber numberWithBool:NO]];

    NSDictionary *properties = [entity propertiesByName];
    request.propertiesToFetch = [NSArray arrayWithObject:[properties objectForKey:@"city"]];
    request.returnsDistinctResults = YES;

    request.fetchBatchSize = 20;

    NSFetchedResultsController *frc = [[NSFetchedResultsController alloc] initWithFetchRequest:request
                                                                          managedObjectContext:context
                                                                            sectionNameKeyPath:nil
                                                                                     cacheName:@"CityCache"];
    [request release];

    self.fetchedResultsController = frc;
    [frc release];
Run Code Online (Sandbox Code Playgroud)

问题是结果返回同一城市的很多次.该实体有很多会员,每个会员都有一个属性"城市".

我究竟做错了什么?

谢谢,

RL

iphone core-data nspredicate distinct-values ios

5
推荐指数
2
解决办法
7752
查看次数

UINavigationBar后退按钮不会出现

我有一个navigationBar,它的标题上有UIImage,如下所示:

self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"top_logo.png"]];
Run Code Online (Sandbox Code Playgroud)

当我选择一行时,不会出现"后退"按钮.为什么?

我在其他的viewControllers上有完全相同的代码,它出现了.我不明白为什么......

谢谢,

RL

iphone uinavigationbar uibuttonbaritem

4
推荐指数
1
解决办法
6371
查看次数

UITongPress上的UILongPressGestureRecognizer - 双重调用

我在一个单元格中使用UILongPressGestureRecognizer.我需要的是:当用户点击一个单元格1.0秒时,调用一个视图控制器.如果用户点击该单元格,则另一个VC.

我可以通过使用UILongPressGestureRecognizer来实现这一点.但问题是调用viewController两次.

码:

if (indexPath.section == 0 && indexPath.row == 1){
    UILongPressGestureRecognizer *longPressTap = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(memberListWithSearchOptions)];

    longPressTap.minimumPressDuration = 1.0;

    [cell addGestureRecognizer:longPressTap];
    [longPressTap release];
}
Run Code Online (Sandbox Code Playgroud)

我认为我需要的是,在识别出LongPress后,禁用识别器,直到tableView再次出现在屏幕上.

我怎样才能做到这一点?

谢谢,

RL

uitableview uigesturerecognizer ios

4
推荐指数
1
解决办法
3329
查看次数