小编gre*_*reg的帖子

在Cordova/PhoneGap中生成iOS和Android图标

我有一个新创建的Cordova项目,具有以下config.xml设置(使用http://docs.phonegap.com/en/edge/config_ref_images.md.html中的说明).我还添加了2个平台(iOS和Android).

当我运行cordova run ios或者cordova run android,项目仍然有默认的Cordova图标.我从文档中了解到,Corodva应该根据icon.png我提供的内容自动创建图标config.xml.

config.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.testapp" version="1.1.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>SingleApp</name>
  <preference name="DisallowOverscroll" value="true" />
  <preference name="AutoHideSplashScreen" value="false" />
  <preference name="Orientation" value="portrait" />
  <preference name="Fullscreen" value="false" />
  <preference name="target-device" value="handset" />

  <description>
      A sample Apache Cordova application that responds to the deviceready event.
  </description>
  <author email="dev@cordova.apache.org" href="http://cordova.io">
      Apache Cordova Team
  </author>
  <content src="index.html" />
  <access origin="*" />

  <icon src="icon.png" />

</widget>
Run Code Online (Sandbox Code Playgroud)

android ios phonegap-plugins cordova cordova-plugins

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

UITableView的Autolayout错误

我有一个TableView,我使用委托方法指定每个单元格的高度tableView:heightForRowAtIndexPath:.

当我旋转视图时,我得到了这个我不太明白的错误.

它不能满足下面的约束并打破它继续.

"<_UIScrollViewAutomaticContentSizeConstraint:0x8e8d040 UITableView:0x9423400.contentHeight{id: 213} == -1568.000000>"
Run Code Online (Sandbox Code Playgroud)

有谁知道发生了什么以及为什么我打破了这个限制?

iphone ios autolayout nslayoutconstraint

13
推荐指数
3
解决办法
5605
查看次数

如何通过点击更改UILabel的alpha?

我有一个iOS(4.0)应用程序,我想通过在屏幕上的任何地方录制来更改特定UILabel的alpha.我没有以编程方式完成我的界面,我只是使用界面构建器将事物的标签放在屏幕上.

如何使用轻击手势更改程序中特定UILabel的alpha?

提前致谢!

iphone alpha uilabel ios

6
推荐指数
1
解决办法
7581
查看次数

popoverPresentationController从iPhone上的UITableViewController以模态方式显示

我有一个问题,显示一个UIViewController带有来自iPhone的popover演示文稿UITableViewController.我一直在使用的代码用于显示来自任何其他的弹出窗口UIViewController,而不是UITableViewControlleriPhone上的弹出窗口.它可以UITableViewController在iPad上运行.

执行代码时,视图以模态方式暂时呈现(如果我没有实现,可能会如此adaptivePresentationStyleForPresentationController),然后用黑色覆盖,就好像发生了某种类型的自动布局错误(尽管控制台中没有任何内容可以指示其他情况).

正如我所提到的,以下内容适用UITableViewController于iPhone之外,并且一直在iPad上运行.我敢肯定我错过了一些相当简单的东西.有任何想法吗?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    /* Create label */
    UILabel *label = [UILabel new];
    label.text = @"This should be in a popover.";
    label.numberOfLines = 0;
    label.lineBreakMode = NSLineBreakByWordWrapping;

    /* Add label to new ViewController */
    UIViewController *popoverVC = [UIViewController new];
    [popoverVC.view addSubview:label];
    label.translatesAutoresizingMaskIntoConstraints = NO;
    [popoverVC.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[label]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(label)]];
    [popoverVC.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[label]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(label)]];

    /* Define ViewController to present …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview uiviewcontroller ios

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

在fopen + mode中从多个线程/进程写入锁定文件之前是否需要同步/刷新?

我正在从多个线程对单个文件执行I/O. foo通过建议文件锁(flock(2)LOCK_EX)来控制对此共享文件的访问. foofopen(3)模式打开了a+. a+之所以被选中,是因为文件说明:

对文件的后续写入将始终以当前文件末尾结束,无论是否有任何干预fseek(3)或类似.

简化后,操作将开始:

FILE *fp = fopen("foo", "a+");
...spawn threads...
Run Code Online (Sandbox Code Playgroud)

写作将继续:

flock(fileno(fp), LOCK_EX);
fwrite(buffer, buffer_size, 1, fp);
flock(fileno(fp), LOCK_UN);
Run Code Online (Sandbox Code Playgroud)

我目前没有任何fflush(3)fsync(2)电话fwrite(3),我想知道我是否应该.fopen(3) a+在计算"当前EOF"时,模式是否会考虑多个线程命中文件?我知道,flock(2)当有出色的I/O时,给我锁定可能没有问题.

在我的有限测试中(写入非常长的ASCII文本行,然后在多个线程中使用换行多秒,然后确保生成的文件中每行的字符数相等),我没有看到任何"损坏"使用fflush(3)fsync(2).它们的存在大大降低了I/O性能.

tl; dr:使用文件锁时,是否需要在打开a+模式下写入多个线程之间的共享文件之前刷新流?多个叉子/不同的机器写入文件并行文件系统?

可能相关: 为什么在读/写"+"模式下读写之间总是需要fseek或fflush

c concurrency fopen locking file

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