小编Dr.*_*eon的帖子

一个接一个地显示NSAlert表单模态

我想显示一张工作表,当用户点击"确定"时,显示另一张工作表.

然而,点击"确定"的那一刻整个设计变得一团糟,好像第一张警报表没有足够的时间消失.

这是我用于表单的代码:

#define CONFIRM_ALERT(X,Y,Z,W,V) \
NSAlert* confirmAlert = [NSAlert alertWithMessageText:X \
defaultButton:@"OK" \
alternateButton:@"Cancel" \
otherButton:nil \
informativeTextWithFormat:Y]; \
[confirmAlert beginSheetModalForWindow:Z \
modalDelegate:self \
didEndSelector:W \
contextInfo:V];

#define INFO_ALERT(X,Y,Z) \
NSAlert *infoAlert = [[NSAlert alloc] init]; \
[infoAlert addButtonWithTitle:@"OK"]; \
[infoAlert setMessageText:X]; \
[infoAlert setInformativeText:Y];\
[infoAlert setAlertStyle:NSInformationalAlertStyle]; \
[infoAlert beginSheetModalForWindow:Z modalDelegate:self didEndSelector:nil contextInfo:nil];
Run Code Online (Sandbox Code Playgroud)

以及我如何使用它:

- (void)doSth
{
       CONFIRM_ALERT(@"New Action", 
               @"Are you sure you want to proceed?", 
               [self window], 
               @selector(confirm:code:context:),
               nil);
}

- (void)confirm:(NSAlert*)alert code:(int)choice context:(void *)filename
{
    if (choice …
Run Code Online (Sandbox Code Playgroud)

cocoa modal-dialog objective-c nsalert

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

(Mac)创建执行shell脚本的Xcode应用程序

这似乎是我想要完成的一件简单的事情,远远低于Xcode/Interface Builder的能力.我搜索并搜索过,但没有提出我的答案,但大多数搜索引导我到这里,所以我创建了一个帐户来询问专家.我想创建一个非常简单的GUI,它将有四到五个按钮,每个按钮执行一个简单的shell脚本,终端窗口将不是必需的,但我可以忍受一个启动,如果这是它的方式.除了shell脚本,我还需要在应用程序中使用adb(Android调试桥)和fastboot实用程序.我假设我需要在Resources文件夹中放置adb和fastboot以及我的其他文件,我还假设我需要将我的shell scrips放在Classes文件夹中.我真的只需要知道如何将按钮连接到脚本,我希望它只是一些我忽略的简单.提前致谢.

MacBook Pro 7,1 OSX 10.6.8 Xcode 3.2.6

shell xcode cocoa objective-c

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

为什么使用两种类型(边界/框架)来描述视图而不是一个?

我想知道为什么有两种类型(边界/框架)来描述视图.由于更改视图的bounds.size.*也会更改该视图的frame.size.*,反之亦然,这意味着框架和边界之间的唯一区别是它们的原点,那么为什么我们需要两种不同的类型来描述视图几何?顺便说一下bounds.origin到底意味着什么?

xcode cocoa objective-c ios

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

从php中的数组中删除重复项

我想从php中删除数组中的重复元素.以下是数组的结构

Array
(
    [0] => Array
        (
            [0] => xllga@hotmail.com
            [1] => bounce@abc.com
            [2] => 20120416135504.21734.qmail@abc.com
            [3] => xllga@hotmail.com
            [4] => info@abc.com
            [5] => info@abc.com
            [6] => xllga@hotmail.com
            [7] => xllga@hotmail.com
        )

)
Run Code Online (Sandbox Code Playgroud)

怎么去呢?

php arrays duplicates array-unique

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

Exec命令不起作用

我正在使用exec来运行这样的后台脚本:

$command = "/usr/local/bin/php public_html/r/index.php tools $action process $params > /dev/null &";
exec($command);
Run Code Online (Sandbox Code Playgroud)

问题是:它工作.

提示:

  • 当我从终端(通过SSH)执行相同的命令时,它工作正常.
  • exec命令已启用(我可以执行任何命令而不会出现问题).

有任何想法吗?

php codeigniter exec shell-exec command-line-interface

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

添加图例到圆环图 - jqPlot

好的,这应该相对简单:

在此输入图像描述

  • 我正在添加一个圆环图,它确实有效
  • 但是,"图例"(Head (+)与相应的颜色一起)不会显示.

代码:

$(document).ready(function(){
  var s1 = [['Head (+)',<?php echo $headScore; ?>], ['Head (-)',<?php echo 6-$headScore; ?>]];
  var s2 = [['Body (+)',<?php echo $totalScore-$headScore; ?>], ['Body (-)',<?php echo 7-$totalScore+$headScore; ?>]];

  var plot3 = $.jqplot('linkchart', [s1,s2], {
      title:"Score Profile",
    seriesDefaults: {
      // make this a donut chart.
      renderer:$.jqplot.DonutRenderer,
      rendererOptions:{
        // Donut's can be cut into slices like pies.
        sliceMargin: 3,
        // Pies and donuts can start at any arbitrary angle.
        startAngle: -90,
        showDataLabels: false
      },
      legend: { …
Run Code Online (Sandbox Code Playgroud)

javascript jquery charts jqplot donut-chart

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

Objective-C类别未被识别?

嗯,这是一个非常奇怪的问题.(我只是希望它与我不玩的时间有关 - 可以和Cocoa一起玩,或者......)

所以,问题非常简单:

  • 我正在使用Xcode 4.3.3(一个非常简单的测试项目--10.7 SDK - 没有ARC)
  • 我在某些类上创建了一个类别(例如NSProgressIndicator)
  • 我包含了相应的头文件
  • 当我尝试使用我的任何类别的方法时(但它仍显示在可用命令的下拉列表中),我收到一个错误:

[NSProgressIndicator start]:无法识别的选择器发送到实例0x7f9f4b91a0a0

代码

(作为一个例子 - 它发生在其他(100次测试)类别):

#import <Foundation/Foundation.h>


@interface NSProgressIndicator (NSProgressIndicator_Functions)

- (void)start;
- (void)stop;

@end
Run Code Online (Sandbox Code Playgroud)
#import "NSProgressIndicator+Functions.h"


@implementation NSProgressIndicator (NSProgressIndicator_Functions)

- (void)start
{
    [self setHidden:NO];
    [self startAnimation:nil];
}

- (void)stop
{
    [self setHidden:YES];
    [self stopAnimation:nil];
}

@end
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

cocoa objective-c unrecognized-selector objective-c-category

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

使用 CSS 排列隐藏元素

好的,这就是我需要的:

  • 我有一个水平容器(我们称之为 C),包含 2 个元素 (A,B)
  • 在这两个元素中,只有一个必须随时可见。因此,另一个的visibility属性设置为hidden
  • 假设这些元素按照这个确切的顺序 : 放置|<----------- A B ->|,因此是右对齐的。
  • 当元素 B 处于活动状态时,一切正常。
  • 当元素 A 处于活动状态时(因此 B 是不可见的),A 元素不会浮动到右侧并保持原位: |<----------- A --->|

问题:

  • 如何将元素 A 向右“推”(“上方”元素 B),使其就像向右浮动/

html css twitter-bootstrap

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

无符号长龙 - 奇怪的输出

好的,我正在尝试打印相对较大的十进制/十六进制版本,unsigned long long我得到的结果很奇怪......

代码 :

unsigned long long a = 1llu<<63;

printf("decimal = %llu\n",a);
printf("hexadecimal = %llx\n",a);
Run Code Online (Sandbox Code Playgroud)

输出 :

decimal = 9223372036854775808
hexadecimal = 8000000000000000
Run Code Online (Sandbox Code Playgroud)

现在,这是什么:

  • 十六进制输出正确的.
  • 十进制输出不是(应该是9223372036854780000)

为什么会这样?我究竟做错了什么???

c c++ macos gcc g++

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

如何将BOOST_FOREACH与Unordered_map一起使用?

好的,所以这是我的情况 - 非常简单,但我不确定它是如何工作的(我找不到任何文件......):

我有一个Unordered_map:

typedef unsigned long long U64;
typedef boost::unordered_map<U64, U64> HASH;
Run Code Online (Sandbox Code Playgroud)

我想循环遍历元素(主要是键),非常像使用PHP foreach,但这次使用BOOST_FOREACH,我怀疑像:

HASH myMap;

// .. assignment, etc...

BOOST_FOREACH (U64 key, myMap)
{
     // do sth with the Key-Value pair

     U64 val = myMap[key];
}
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

c++ foreach boost unordered-map

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