我想允许用户搜索街道名称并将结果显示在UITableView中.目前该地区并不重要,它可以来自任何地区.
我在搜索中找不到任何相关示例,我不知道是否应该使用CLLocation或MKLocalSearch.
根据文档,我应该使用MKLocalSearch:
虽然本地搜索和地理编码类似,但它们支持不同的用例.如果要在地图坐标和结构化地址(例如地址簿地址)之间进行转换,请使用地理编码.如果要查找与用户输入匹配的一组位置,请使用本地搜索.
但我尝试了两种方法,它只给了我一个结果(即使 - 虽然有一个NSArray返回.
这是CLGeocoder方法:
CLGeocoder *geocoding = [[CLGeocoder alloc] init];
[geocoding geocodeAddressString:theTextField.text completionHandler:^(NSArray *placemarks, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSLog(@"%i", [placemarks count]);
for(CLPlacemark *myStr in placemarks) {
NSLog(@"%@", myStr);
}
}
}];
Run Code Online (Sandbox Code Playgroud)
这是我的MKLocalSearch尝试:
MKLocalSearchRequest *request = [[MKLocalSearchRequest alloc] init];
request.naturalLanguageQuery = theTextField.text;
request.region = self.region;
localSearch = [[MKLocalSearch alloc] initWithRequest:request];
[localSearch startWithCompletionHandler:^(MKLocalSearchResponse *response, NSError *error){
if (error != nil) {
[[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Map Error",nil)
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK",nil) otherButtonTitles:nil] show]; …Run Code Online (Sandbox Code Playgroud) 我正在使用jsf 2.0,我有两个bean导航(应用程序范围)和模块(请求范围).我想在Module Bean中使用Navigation bean的方法.我在模块Bean中这样做
@ManagedProperty(value = "#{navigationBean}")
private NavigationBean navigationBean;
Run Code Online (Sandbox Code Playgroud)
但是当我试图得到navigationBean.SomeMethod它时,它不起作用,因为导航bean是null.这该怎么做?
我正在使用以下代码来显示视频库
-(IBAction)showVideoLibrary
{
UIImagePickerController *videoPicker = [[UIImagePickerController alloc] init];
videoPicker.delegate = self;
videoPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
videoPicker.mediaTypes =[[NSArray alloc] initWithObjects: (NSString *)kUTTypeMovie,nil];
if(self.popoverController!=nil)
{
[self.popoverController release];
}
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:videoPicker];
popoverController.delegate = self;
popoverController.popoverContentSize=CGSizeMake(320,1000);
[popoverController presentPopoverFromRect:CGRectMake(0,0,10,10) inView:self.view permittedArrowDirections:nil animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
并且为了接收所选的视频网址,我使用以下功能
- (void)imagePickerController: (UIImagePickerController *)picker2 didFinishPickingMediaWithInfo: (NSDictionary *)info {
NSString *mediaType = [info valueForKey:UIImagePickerControllerMediaType];
if([mediaType isEqualToString:@"public.movie"])
{
NSLog(@"came to video select...");
NSURL *videoUrl=(NSURL*)[info objectForKey:@"UIImagePickerControllerMediaURL"];
NSLog(@"Got Movie Url==%@",videoUrl);
}
Run Code Online (Sandbox Code Playgroud)
这是我正在使用的代码,我可以看到视频列表存在于库中,但是当我按下"USE"按钮时,它显示压缩视频..我无法取消它,我没有得到任何类型的网址中的
- (void)imagePickerController: (UIImagePickerController *)picker2 didFinishPickingMediaWithInfo: (NSDictionary *)info
Run Code Online (Sandbox Code Playgroud)
功能..任何解决这个问题的想法..并获取应用程序的URL.
谢谢.
这可能是一个愚蠢的问题,但我无法找到答案......
我有一个UIScrollView和许多UIButtons.当我按下按钮时,我想知道按钮的屏幕位置.如果我使用button.frame,它会给我在UIScrollView中的位置,这是正常的.
如何找到相对于按下按钮屏幕的x和y?
提前致谢.
我从odata.org下载了oData4J jar文件,我打算在基本的Web服务中做一个样本生成器.
我假设来自http://code.google.com/p/odata4j/的 InMemoryProducerExample.java 将完成这项工作,而且很可能就是这样.
我的问题是我不知道要创建哪种类型的项目(Eclipse Java),如何部署和测试这个例子.
有没有人一步一步地为odata启动这样的启动hellow world教程,或者使用来自oData的InMemoryProducerExample.java的eclipse项目.我真的需要一个起点,我可以在网上看到一个.
谢谢.
是否有任何解决方案使用他的语言环境设置向用户显示日期,但是单词是否使用不同的语言?
我想要的是显示给用户设置en_US德语日期(例如月份名称,工作日).
我有一个类似这样的查询:
SELECT username
FROM users
WHERE locationid IN
(SELECT locationid FROM locations WHERE countryid='$')
Run Code Online (Sandbox Code Playgroud)
$是我从最终用户获得的值.
我怎么能在CodeIgniter中运行此查询?我在CodeIgnite的用户指南中找不到解决方案.
非常感谢你的回答!
问候!
我希望我的页面上的某些部分保留(如页眉,页脚),只需更改主要内容.同时,URL也应根据新内容进行更改.
我知道所有关于AJAX/iframe但我不想使用它们,因为URL保持不变.
请访问123contactform.com.尝试使用左侧菜单,注意主要内容更改以及URL(标题,菜单,页脚保持不变).
这是如何实现的?
谢谢.
我有一个奇怪的项目,我正在努力.我是php的新手,所以到目前为止一直是一场斗争.
我有一个表格,给出一个数组并发布它:
...
return($keywords);
}
$keywordlist = explode("\r\n", $keywordlist);
foreach($keywordlist as $keyword){
print_r(mixer(strtolower($keyword)));
}
Run Code Online (Sandbox Code Playgroud)
我明白了:
Array ( [0] => one [1] => two [2] => three [3] => four [4] => five [5] => six [6] => ....
Run Code Online (Sandbox Code Playgroud)
但是希望它能像这样出来:
%28one%2Ctwo%2Cthree%2Cfour%2Cfive%2Csix%29
Run Code Online (Sandbox Code Playgroud)
最终希望能够将它附加到像ask.com搜索这样的URL的末尾:
"http://www.ask.com/web?q=(put my keywords here)"
Run Code Online (Sandbox Code Playgroud)
然后导航到那里
从理论上讲,就像我在搜索栏中键入"(一,二,三,四,五,六)"并按下回车键.
希望这是有道理的.
我有一个UITableView,我已经创建了一个自定义单元格来显示我的表格.我显示了6个UILables,虽然我只显示了20个记录,但滚动时速度非常慢.
这就是我的 - tableView:cellForRowAtIndexPath:的样子:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CustomCellIdentifier = @"CustomCellIdentifier";
HistoryCell *cell = (HistoryCell *)[tableView dequeueReusableCellWithIdentifier: CustomCellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"HistoryCell" owner:nil options:nil];
for (id oneObject in nib)
if ([oneObject isKindOfClass:[UITableViewCell class]])
cell = (HistoryCell *) oneObject;
}
NSArray *object;
object = [cours objectForKey: [NSString stringWithFormat:@"%d", indexPath.section]];
History *rowData = [object objectAtIndex:indexPath.row];
if (rowData.month == 99) {
cell.hour.frame = CGRectMake(10, 0, 135, 35);
cell.data.hidden = YES;
cell.hour.textColor …Run Code Online (Sandbox Code Playgroud) xcode ×3
html ×2
iphone ×2
arrays ×1
cllocation ×1
codeigniter ×1
custom-cell ×1
format ×1
ipad ×1
java ×1
jsf-2 ×1
nslocale ×1
objective-c ×1
odata ×1
partial ×1
php ×1
producer ×1
project ×1
uitableview ×1
url ×1