有没有办法立即改变窗口的背景颜色?
我需要一个闪烁的背景,即红色/绿色以一秒的间隔闪烁.正如我所看到的,背景颜色不会立即改变,但仅在剩下功能时才会改变.
有没有办法强制系统更改它并立即重绘窗口的背景?
>>> string1, string2, string3 = '', 'Trondheim', 'Hammer Dance'
>>> non_null = string1 or string2 or string3
>>> non_null
'Trondheim'
Run Code Online (Sandbox Code Playgroud)
这样,通过此的蟒蛇教程页面,我不明白,2号线.
我完全不习惯使用Git(并且发现它比SVN更难使用),并且我注意到我引入的项目被转储到我的C:/ Users //目录中.我更喜欢把它移到其他地方,所以我该怎么做呢?
我正在使用Xcode 4.6.在一个窗口中,我不断得到这个"视图正在剪切其内容"错误,当我点击它时,XIB编辑器会突出显示一个标签.试图告诉我以及如何解决这个错误是什么?
我是stackoverflow的新人:)但我认为,这是问我问题的正确位置.我是Cocoa和Objective-c的新开发人员,我正在尝试编写我的第一个Mac应用程序:ToDo应用程序.
此时,我可以保存ToDo并删除它们,但现在,我想添加一些功能,如CreationDate,一些标签(在mutablearray中),以及ToDo是否完成.我没有使用ArrayController,我将编码的NSMutableArray保存到文件(库/应用程序支持/ AppName)并从那里读取它.
这一切都必须在一行,因为它看起来像这样:
目前的外观http://img683.imageshack.us/img683/7595/bild2ss.png
其中Title应该是ToDo的内容,Blue Box应该是Status(Blue = undone,Gray = Done),Subtitle应该是Date和Tags(03.01.2009 - tag1,tag2) ,tag3)
我现在如何将addObjects添加到mutablearray中,但是,如果我想将所有这4个信息保存到这个数组中,我不知道如何制作它.
我有一个模型,正在初始化这4个信息,但如何保存?我必须在一个数组和我的mutablearray中的数组中保存这个信息吗?
我以为我得到了可可内存管理的支持,但我显然还有很多需要学习的东西.
看看我写的这堂课:
Word.h
#import <UIKit/UIKit.h>
@interface Word : NSObject {
NSString *word;
NSMutableArray *wordArray;
}
@property (nonatomic ,retain) NSString *word;
@property (nonatomic ,retain) NSMutableArray *wordArray;
@end
Run Code Online (Sandbox Code Playgroud)
Word.m
#import "Word.h"
@implementation Word
@synthesize word, wordArray;
- (void)setWord:(NSString *)aWord {
NSMutableArray *newValue = [[NSMutableArray alloc] init];
self.wordArray = newValue;
[newValue release];
for (int i = 0 ;i < [aWord length] ;i++) {
NSString *character = [[NSString alloc] init];
character = [NSString stringWithFormat:@"%C",[aWord characterAtIndex:i]];
[wordArray addObject:character];
//[character release];
}
}
- (void)dealloc { …Run Code Online (Sandbox Code Playgroud) 您将获得一个包含正整数的数组.除了一个整数之外,所有整数都会出现偶数次.找到这个特殊的整数.
方案:
具有奇数出现次数的整数将具有0对或更多对以及一个单个数.所以,如果我们能够如何摆脱所有对,那么我们剩下的就是单个数字.什么摆脱对?提示:想想一个运营商.
异或会做到这一点.它为您提供O(n)解决方案,没有额外的内存.
int GetSpecialOne(int[] array, int length)
{
int specialOne = array[0];
for(int i=1; i < length; i++)
{
specialOne ^= array[i];
}
return specialOne;
}
Run Code Online (Sandbox Code Playgroud) 我想创建一个关于我的项目如何工作的流程图/地图可视化,为此目的可用的最佳软件是什么?我不想自动做某事,我想手动创建流程图.
这是针对在Objective-C中完成的项目,如果有帮助/重要的话.
我正在解析一些JSON.
有时JSON返回一个NSNull,我允许进入一个字符串,然后我会检查字符串,看它是否与NSNull有关,然后处理它.代码按预期工作,但编译器抱怨警告.
if ((theMonograph.cautions != nil) && (theMonograph.cautions != [NSNull null]))
{
//draw string
}
Run Code Online (Sandbox Code Playgroud)
在Monograph.h中
NSString *cautions;
@property (nonatomic, retain) NSString *cautions;
Run Code Online (Sandbox Code Playgroud)
所以我可能正确处理它的方法是更改为NSString位置的id
Monograph.h
id *cautions;
@property (nonatomic, retain) id *cautions;
Run Code Online (Sandbox Code Playgroud)
但这仍然引发了另一个警告
从不兼容的指针类型传递'setCautions:'的参数1
处理这个问题的正确方法是什么?我猜测让NSNull进入一个NSString对象是错误的.但是将id对象放在其位置似乎并不正确.
非常感谢-Code
我正试图通过cabal安装来安装hake.
首先 - 虽然最新的软件包是1.3.7,但cabal试图安装1.2
除此之外:
~ % cabal install hake-1.2
Resolving dependencies...
Configuring hake-1.2...
Building hake-1.2...
Preprocessing library hake-1.2...
Development/Hake.hs:49:8:
Could not find module `System.Directory.Tools'
Perhaps you meant System.Directory (from directory-1.1.0.2)
Use -v to see a list of the files searched for.
Failed to install hake-1.2
cabal: Error: some packages failed to install:
hake-1.2 failed during the building phase. The exception was:
ExitFailure 1
Run Code Online (Sandbox Code Playgroud)
如果我试着更具体 - 我得到其他错误
~ % cabal install hake-1.3.7
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: …Run Code Online (Sandbox Code Playgroud)