我试图在Swift项目中使用SDWebImage.我将SDWebImage库文件夹拖放到我的Swift项目中,并按名称listApp-Bridging-Header.h创建了一个桥接头.
然后我将头文件导入到我的Swift文件中; 像这样进口
import UIImageView+WebCache.h
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
let cell : TableViewCell = self.tableView.dequeueReusableCellWithIdentifier("Cell") as! TableViewCell
let strTitle : NSString = arrDict[indexPath.row].valueForKey("clip_name") as! NSString
cell.clipName.text = strTitle as String
cell.videoImage sd_setImageWithURL=NSURL URLWithString,[NSString stringWithFormat:@"%@%@",K_Server_imageurl,[record valueForKey:@"clip_image_path"]];
return cell
}
Run Code Online (Sandbox Code Playgroud)
它给了我一个错误说明add ; before +如何将上面的文件正确导入我的Swift项目?
我遵循了完全相同的教程,从另一个(iPhone)内部启动应用程序,但是代码仅执行else部分并显示警告,因此无法打开第二个应用程序。您可以在上面的链接中看到我执行的步骤。
假设我们有两个名为FirstApp和SecondApp的应用程序。当我们打开FirstApp时,我们希望能够通过单击一个按钮来打开SecondApp。解决方案是:
在SecondApp中
转到SecondApp的plist文件,您需要添加带有字符串iOSDevTips的URL方案(当然,您可以编写另一个字符串。由您决定)。
2。在FirstApp中
使用以下操作创建一个按钮:
- (void)buttonPressed:(UIButton *)button
{
NSString *customURL = @"iOSDevTips://";
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:customURL]])
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"URL error"
message:[NSString stringWithFormat:@"No custom URL defined for %@", customURL]
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
}
Run Code Online (Sandbox Code Playgroud)