我有tableView searchDisplayController
.在这台电视中,我必须使用数组(名字/姓氏),我可以使用谓词使用此代码按名称过滤此值
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self.firstName beginswith[cd]%@",searchString];
self.filteredAllClients = [AllClients filteredArrayUsingPredicate:predicate];
Run Code Online (Sandbox Code Playgroud)
我可以使用两个谓词过滤此数组吗?
例如:我有名字(Jack Stone,Mike Rango)
如果我进入'J'并且我应该得到过滤阵列 - 杰克斯通
但如果我进入'R'并且我应该进入过滤区域 - Mike Rango?
我需要通过服务器auth方法,需要deviceToken进行注册.但我只有模拟器,不能从他们那里拿取令牌,我想发送到服务器假令牌(如000 000 000)但我不知道设备令牌中有多少位数.任何人都可以使用示例设备令牌帮助我吗?
我正在使用来自mozilla的PDF文档的开源库(pdf.JS).当我试图打开质量差的pdf文档时,查看器会以非常糟糕的质量显示它.
但是如果我在阅读器或浏览器中打开它(拖放到新窗口),那么文档显示效果很好
有可能改变吗?这是github mozilla pdf.js上的这个库
我有UITableView
一个UISearchBar
. 我需要searchBar
通过用户操作(按下按钮)来显示/隐藏我的, :
我尝试使用此代码:
if self.tableView.contentOffset.y == 0 {
self.tableView.contentOffset = CGPoint(x: 0.0, y: self.searchBar.frame.size.height)
}
Run Code Online (Sandbox Code Playgroud)
从这个问题。其实我已经尝试了所有这些答案。他们都只是滚动 my UITableView
,每次我滚动我的UITableView
- 都会searchBar
出现。我试图做这样的事情:
self.newsTableView.tableHeaderView = nil; //Hide
Run Code Online (Sandbox Code Playgroud)
和
self.newsTableView.tableHeaderView = self.SearchBar; //Show
Run Code Online (Sandbox Code Playgroud)
却UITableView
不想回来searchBar
;
我该如何解决这个问题?我需要searchBar
通过操作隐藏,而不是滚动我的UITableView
(像隐藏一样searchBar.hidden = true
)实际上是searchBar.hidden = true
有效的,但是有一个空格而不是searchBar
.
我可以通过这段代码调用一些选择器
[self performSelector:<#(SEL)#> onThread:<#(NSThread *)#> withObject:<#(id)#> waitUntilDone:<#(BOOL)#>]
Run Code Online (Sandbox Code Playgroud)
并且线程将一直等到这个选择器工作(如果我设置waitUntilDone:YES).我的问题是 - 我可以等到一些代码完成吗?
例如.我有一些子视图,加载动画.动画持续时间为2秒.如果我在背景视图上做一些动作,在动画时,我有一个错误.我想等到动画结束.我不能做一个选择器,并使用
[self performSelector:<#(SEL)#> onThread:<#(NSThread *)#> withObject:<#(id)#> waitUntilDone:<#(BOOL)#>]
Run Code Online (Sandbox Code Playgroud)
有什么建议?)
我试图通过此代码在Core Data中插入一些对象
- (void)insertNewObject: (NSArray *) userInfo // ??????? ????? ? ????????? ???? ??????
{
for (int i = 0; i < userInfo.count; i++) {
billContent * bc = [userInfo objectAtIndex:i];
NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity];
NSManagedObject *nmo = [NSEntityDescription insertNewObjectForEntityForName:[entity name]
inManagedObjectContext:context];
[nmo setValue:CountID forKey:@"billId"];
[nmo setValue:bc.billAmount forKey:@"courseCount"];
[nmo setValue:bc.billCourseId forKey:@"courseId"];
[nmo setValue:bc.billPrice forKey:@"coursePrice"];
[nmo setValue:bc.billTitle forKey:@"courseTitle"];
[self saveContext];
}
}
- (void)saveContext {
NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
NSError *error = nil; …
Run Code Online (Sandbox Code Playgroud) 我怎样才能得到本周的一系列日子?
例如 - 今天是saturday - 28 july
.
我需要'28周六的阵列,27 Friday
,26 Thursday
,25 Wednesday
... 22 Sunday
?
[code] NSCalendar*myCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *currentComps = [myCalendar components:( NSYearCalendarUnit | NSMonthCalendarUnit | NSWeekOfYearCalendarUnit | NSWeekdayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit) fromDate:weekDate];
int ff = currentComps.weekOfYear;
NSLog(@"1 %d", ff);
[currentComps setWeekday:1]; // 1: sunday
NSDate *firstDayOfTheWeek = [myCalendar dateFromComponents:currentComps];
[currentComps setWeekday:7]; // 7: saturday
NSDate *lastDayOfTheWeek = [myCalendar dateFromComponents:currentComps];
NSLog(@"first - %@ \nlast - %@", firstDayOfTheWeek, lastDayOfTheWeek); …
Run Code Online (Sandbox Code Playgroud) 我有这样的网址:
http://localhost:9562/Account/LogOn?ReturnUrl=%2fCabinet%2fCabinet
Run Code Online (Sandbox Code Playgroud)
我需要解析它:
Cabinet/Cabinet
Run Code Online (Sandbox Code Playgroud)
我正在尝试为protobuf编码库创建base64数据.我找到了这段代码:
/* Create a Base-64, UTF-8 encoded NSData from the receiver's contents using the given options.
*/
@availability(iOS, introduced=7.0)
func base64EncodedDataWithOptions(options: NSDataBase64EncodingOptions) -> NSData
Run Code Online (Sandbox Code Playgroud)
在NSData的源代码中.正如我所知,此方法必须返回base64encoded NSDate.
但我无法理解,如何将我的NSData(我从API接收)转换为此Base64 NSDate.
ios ×7
objective-c ×4
swift ×3
animation ×1
asp.net ×1
asp.net-mvc ×1
base64 ×1
c# ×1
core-data ×1
ipad ×1
mozilla ×1
nsdata ×1
pdf.js ×1
query-string ×1
uisearchbar ×1