我有一个程序需要在Tiger上的行为略有不同于Leopard.有没有人知道系统调用,这将允许我准确地确定正在运行的Mac OS XI版本.我已经找到了许多宏定义来确定构建机器的操作系统,但是没有什么能够确定正在运行的机器的操作系统.
谢谢,乔
我是一个沉重的命令行用户,并find在我的构建系统脚本中广泛使用该命令.但是在Mac OS X上,当我不专注时,我经常得到这样的输出:
$ find -name \*.plist
find: illegal option -- n
find: illegal option -- a
find: illegal option -- m
find: illegal option -- e
find: *.plist: No such file or directory
Run Code Online (Sandbox Code Playgroud)
基本上,我忘了添加小点:
$ find . -name \*.plist
Run Code Online (Sandbox Code Playgroud)
因为BSD find需要路径而GNU find不需要(如果你没有指定,则它假设当前目录).我经常同时使用Linux,Mac OS X和Cygwin,因此让我的所有工具表现相同对我有很大好处.我试着编写一个bash find函数,如果我忘了就添加"./",但是我失败了.谢谢你的帮助.:)
目标:取一个UIImage,在中间裁剪出一个正方形,将正方形的大小改为320x320像素,将图像切割成16个80x80图像,将16个图像保存在一个数组中.
这是我的代码:
CGImageRef originalImage, resizedImage, finalImage, tmp;
float imgWidth, imgHeight, diff;
UIImage *squareImage, *playImage;
NSMutableArray *tileImgArray;
int r, c;
originalImage = [image CGImage];
imgWidth = image.size.width;
imgHeight = image.size.height;
diff = fabs(imgWidth - imgHeight);
if(imgWidth > imgHeight){
resizedImage = CGImageCreateWithImageInRect(originalImage, CGRectMake(floor(diff/2), 0, imgHeight, imgHeight));
}else{
resizedImage = CGImageCreateWithImageInRect(originalImage, CGRectMake(0, floor(diff/2), imgWidth, imgWidth));
}
CGImageRelease(originalImage);
squareImage = [UIImage imageWithCGImage:resizedImage];
if(squareImage.size.width != squareImage.size.height){
NSLog(@"image cutout error!");
//*code to return to main menu of app, irrelevant here
}else{
float newDim = squareImage.size.width;
if(newDim …Run Code Online (Sandbox Code Playgroud) 我在UINavigationController的导航栏上使用自定义tintColor,因为颜色太浅,我需要使用深色文本.交换标题视图和我在右侧添加的自定义按钮相对容易,但我似乎无法通过后退按钮获得自定义视图.这就是我现在正在尝试的:
UILabel *backLabel = [[UILabel alloc] initWithFrame:CGRectZero];
[backLabel setFont:[UIFont fontWithName:[[UIFont fontNamesForFamilyName:@"Arial Rounded MT Bold"] objectAtIndex:0] size:24.0]];
[backLabel setTextColor:[UIColor blackColor]];
[backLabel setShadowColor:[UIColor clearColor]];
[backLabel setText:[aCategory displayName]];
[backLabel sizeToFit];
[backLabel setBackgroundColor:[UIColor clearColor]];
UIBarButtonItem *temporaryBarButtonItem=[[UIBarButtonItem alloc] initWithCustomView:backLabel];
temporaryBarButtonItem.customView = backLabel;
[backLabel release];
self.navigationItem.backBarButtonItem = temporaryBarButtonItem;
[temporaryBarButtonItem release];]
Run Code Online (Sandbox Code Playgroud)
虽然自定义视图不坚持,但我没有看到任何明显简单的方法来获取默认按钮内的实际文本并开始更改其样式.
现在看来越来越多的OS X应用程序正在为自定义控件做各种精美的绘图工作.像Twitterific,Things,EventBox,Versions等应用程序仅举几例....
所以基本上我正在寻找有关如何开始做这种事情的任何信息.不确定它是否只是通过子类化控件和使用自定义绘图来完成,或者它是否完全不同.
任何帮助是极大的赞赏.谢谢!
使用Cocoa框架,我如何将@"2008-12-29T00:27:42-08:00"解析为NSDate对象?标准-dateWithString:不喜欢它.
我最近听到了很多对Apple核心数据架构的赞誉.
在Java领域是否有类似的东西,以便我可以使用Core Data的想法(为了评估它如何与Hibernate之类的东西叠加)而不必首先进入Cocoa/Objective-C?
假设一个类Vehicle有一个名为"StartEngine"的方法,在我的子类中称为"Airplane",我想覆盖"StartEngine".如果我使用C#,我应该使用Airplane的StartEngine方法声明/定义中的"override"关键字.
我问的原因是,如果不是"StartEngine"我键入"startengine",C#会抱怨,但是由于该关键字,Objective-C不会.
cocoa ×4
macos ×3
objective-c ×3
cocoa-touch ×2
iphone ×2
bash ×1
command-line ×1
core-data ×1
date ×1
find ×1
java ×1
macos-carbon ×1
parsing ×1
persistence ×1
text-editor ×1
xcode ×1