小编Dev*_*evC的帖子

在XML Android中添加背景图像以进行整形

如何在形状中添加背景图像?我在下面尝试的代码但没有成功:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
//here is where i need to set the image
<solid android:color="@drawable/button_image"/>
    <corners
     android:bottomRightRadius="5dp"
     android:bottomLeftRadius="5dp"
     android:topLeftRadius="5dp"
     android:topRightRadius="5dp"/>
 </shape>
Run Code Online (Sandbox Code Playgroud)

android android-xml

137
推荐指数
5
解决办法
17万
查看次数

canOpenUrl - 此应用程序不允许查询方案instragram

我试图将iOS网址添加到我在iOS9中的应用程序但是我收到以下警告:

-canOpenURL: failed for URL: "instragram://media?id=MEDIA_ID" - error: "This app is not allowed to query for scheme instragram"
Run Code Online (Sandbox Code Playgroud)

但是,我LSApplicationQueriesSchemes在我的内容中添加了以下内容info.plist;

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>instagram</string>
    <string>instagram://media?id=MEDIA_ID</string>//this one seems to be the issue
</array>
Run Code Online (Sandbox Code Playgroud)

任何帮助是极大的赞赏?

编辑1

这是我用来打开Instagram的代码:

 NSURL * instagramURL = [NSURL URLWithString:@"instragram://media?id=MEDIA_ID"];//edit: note, to anyone copy pasting this code, please notice the typo OP has in the url, that being "instragram" instead of "instagram". This typo was discovered after this StackOverflow question was posted.
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) { …
Run Code Online (Sandbox Code Playgroud)

ios info-plist instagram ios9

78
推荐指数
3
解决办法
6万
查看次数

在UIWebview中添加了空白 - 删除了iOS7和iOS8中的UIWebView空白

我正在加载本地html文件,因为iOS7在UIWebView上面添加了空白区域.(我无法发布图像,因为我没有足够的点.) 图像可以在这里看到 - 从iPhone模拟器拍摄,uiwebview被黑色包围框架,html内容是灰色的,但上面加了白色

我试图使用调整缩放

[webView stringByEvaluatingJavaScriptFromString:@"document. body.style.zoom = 5.0;"];
webView.scalesPageToFit = NO;
Run Code Online (Sandbox Code Playgroud)

我也尝试删除白色间距:

 NSString *padding = @"document.body.style.margin='0';document.body.style.padding = '0'";
[webView stringByEvaluatingJavaScriptFromString:padding];
Run Code Online (Sandbox Code Playgroud)

仍然没有运气.在桌面Chrome浏览器中没有空格.html文件是Google Swiffy文件 - 包含html和JSON.

编辑:更新图像

objective-c uiwebview ios7 ios8

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

工作副本"<项目名称>"无法提交文件 - 无法与帮助应用程序通信

我刚刚更新到Xcode 7一般版本,我尝试过提交文件.然而它失败了,我得到以下信息;

在此输入图像描述

我已经看到了这个问题,但OP问题的次要响应是不同的:Xcode和Git源代码控制:"工作副本XXXXX无法提交文件"

什么是它正在寻找的"帮助应用程序",是什么解决方案?迁移到Xcode 7和iOS9变得很头疼:(我通过转到'Source Control' - >'Commit'来提交我的文件

git xcode commit xcode7

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

在第一次加载视图时预选择/突出显示UICollectionViewCell

我试图在UICollectionView中预先选择第一个对象/ UICollectionViewCell?我试过了:

self.dateCollectionView.allowsMultipleSelection=NO;

[self.dateCollectionView selectItemAtIndexPath:0 animated:YES scrollPosition:UICollectionViewScrollPositionLeft];
[self collectionView:self.dateCollectionView didSelectItemAtIndexPath:0];
[self.dateCollectionView reloadData];
Run Code Online (Sandbox Code Playgroud)

viewDidLoad.

这是我的UICollectionView方法;

 -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{

  return self.titles.count;
 }

 -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{

    UICollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
    cell.backgroundColor= [UIColor clearColor];
    UILabel * dateLabel = (UILabel *)[cell viewWithTag:1];
    UILabel * subText = (UILabel *)[cell viewWithTag:2];
    subText.text=self.titles[indexPath.row];
    subText.adjustsFontSizeToFitWidth=YES;
    if (cell.selected) {
        cell.backgroundColor = [UIColor blueColor]; // highlight selection
    }
    else
    {
        cell.backgroundColor = [UIColor redColor]; // Default color
    }
    return cell;
}

-(void)collectionView:(UICollectionView …
Run Code Online (Sandbox Code Playgroud)

objective-c ios uicollectionview uicollectionviewcell

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

自动属性合成不会合成属性 - 新警告iOS8.3

在更新到iOS8.3后,我开始收到一些在iOS8.2上没有的新警告.特别引起我注意的一个;

@property (strong, nonatomic) IBOutlet UITableView *tableView;
Run Code Online (Sandbox Code Playgroud)

它是在'.m'文件中声明的.

iOS8.3中发生了哪些变化,使其成为警告?

Auto property synthesis will not synthesize property 'tableView'; it will be implemented by its superclass, use @dynamic to acknowledge intention
Run Code Online (Sandbox Code Playgroud)

ios synthesize ios8.3

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

架构arm64的未定义符号 - Cocoa Pods

我在尝试构建应用程序时遇到此问题:

在此输入图像描述

在尝试更新我的Cocoa pod后,我遇到了问题.

编辑:

这就是你所说的@nunofmendes吗?

在此输入图像描述

编辑2:

我的pods项目看起来像这样:

在此输入图像描述

objective-c ios cocoapods

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

UITextField - 仅允许数字和标点输入/键盘

我尝试过下面的代码,但只允许输入键盘上的数字.我的应用程序要求键盘使用句点/句号(用于金钱交易).我试过的代码是:

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {

   NSCharacterSet *nonNumberSet = [[NSCharacterSet decimalDigitCharacterSet] invertedSet];

     if ([string rangeOfCharacterFromSet:nonNumberSet].location != NSNotFound)
      {
         return NO;
    }
   return YES;

}
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助.

numbers ios iphone-keypad

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

模态视图控制器,关闭并弹回以查看控制器

我试图解雇一个被调用的ModaViewController C,回到A.ModalViewController出现在B.因此导航流程为A-> B - (现在的ModalView) - > C.我能够将ModalViewController后退关闭到B,但是我无法在完成括号中弹回A.这是我尝试过的代码:

[self dismissViewControllerAnimated:YES completion:^{
    [self.navigationController popToViewController:[[self.navigationController viewControllers] objectAtIndex:0] animated:YES];
}];
Run Code Online (Sandbox Code Playgroud)

ModalViewController被解除但不会弹回A.我在一个代码中调用了这个代码块IBAction.

有什么建议?

在第二个注释,当我解雇ModalViewController所有我UIPickers的控制器B是空的/解除分配.我也在使用ARC.

modalviewcontroller ios poptoviewcontroller

5
推荐指数
1
解决办法
6532
查看次数

可可豆荚的问题

我的问题很严重CocoaPod.我不得不Cocoa pods为Yosemite 更新.然后我运行pod更新并收到以下警告消息:

[!] The `app [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
Run Code Online (Sandbox Code Playgroud)

[!] The `app [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build …
Run Code Online (Sandbox Code Playgroud)

objective-c ios cocoapods

5
推荐指数
1
解决办法
7246
查看次数