我试图NSString
通过引用传递,但它不起作用.
这是功能:
+(void)fileName:(NSString *) file
{
file = @"folder_b";
}
Run Code Online (Sandbox Code Playgroud)
这就是电话:
NSString *file;
[function fileName:file];
nslog(@"%@",file); // and there is nothing in the string....
Run Code Online (Sandbox Code Playgroud)
我必须做什么来通过引用传递我的字符串?
我知道有关于这个主题的问题,但我认为可以更改键盘的完成按钮的文本,因为我使用的许多应用程序都是法语,完成按钮的文本是"accéder".
但我不知道怎么做?
如果我有两个nsdatecomponent,我想知道第一个对象中的TIME是否大于第二个.
例:
if (nsdatecomponentObject1 > nsdatecomponentObject2)
{
//something
}
Run Code Online (Sandbox Code Playgroud)
因为这种方式不起作用,我怎么能这样做?
我尝试播放alertSound,但我有4个错误,这是我的功能:
#import "AudioToolbox/AudioServices.h"
+(void)jouerSon:(NSString *)fichierSon:(NSString *) extensionFichier
{
NSString* soundPath = [[NSBundle mainBundle] pathForResource:fichierSon ofType:extensionFichier];
CFURLRef baseURL = (CFURLRef) [NSURL fileURLWithPath:soundPath];
SystemSoundID mysound;
AudioServicesCreateSystemSoundID(baseURL,&mysound);
AudioServicesPropertyID flag = 0;
AudioServicesSetProperty(kAudioServicesPropertyIsUISound,sizeof(SystemSoundID), &mysound, sizeof(AudioServicesPropertyID), &flag);
AudioServicesPlayAlertSound(mysound);
//AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
AudioServicesDisposeSystemSoundID(mysound);
}
Run Code Online (Sandbox Code Playgroud)
这是日志错误:
Ld build/Debug-iphonesimulator/ProjetMission.app/ProjetMission normal i386
cd /Users/sylvainlaroche/iPhone/ProjetMission
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk -L/Users/sylvainlaroche/iPhone/ProjetMission/build/Debug-iphonesimulator -F/Users/sylvainlaroche/iPhone/ProjetMission/build/Debug-iphonesimulator -filelist /Users/sylvainlaroche/iPhone/ProjetMission/build/ProjetMission.build/Debug-iphonesimulator/ProjetMission.build/Objects-normal/i386/ProjetMission.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework CoreGraphics -o /Users/sylvainlaroche/iPhone/ProjetMission/build/Debug-iphonesimulator/ProjetMission.app/ProjetMission
Undefined symbols:
"_AudioServicesDisposeSystemSoundID", referenced from:
+[FonctionUtile jouerSon::] in FonctionUtile.o …
Run Code Online (Sandbox Code Playgroud) 我尝试更改动作表的背景颜色,我只是使用方法:
[actionSheet setBackgroundColor:[UIColor colorWithRed:30 green:30 blue:30 alpha:0.5]];
我把它放在willPresentActionSheet中.但背景颜色不变,为什么?
为什么当我编码我可以做:
NSString *test;
test = @"stack";
test = @"overflow";
Run Code Online (Sandbox Code Playgroud)
没有任何问题,NSString
是不是应该是不可改变的?
我用两个按钮和一个文本字段创建一个uialertview,如果textfield为空,我想要禁用"Ok"按钮.如何获取uibutton对象,更改是启用状态.
我有一个关于retain和NSString的问题,如果我有一个返回NSString的方法,并且我将返回的NSString放在一个nsstring变量中,我必须保留或不保留?
NSString *myString = @"";
myString = [self methodWhoReturnString]; // I must do this?
myString = [[self methodWhoReturnString]retain]; // Or I must do this?
Run Code Online (Sandbox Code Playgroud) 我有一个UIViewController,带有一个navigationController,我隐藏了后退按钮.这个viewController推送另一个UIViewController,并在这个新的viewController的viewDidLoad中,我做:
self.navigationItem.hidesBackButton = FALSE;
Run Code Online (Sandbox Code Playgroud)
但是后退按钮不会发生.为什么?当我转到iOS 4.2的新Xcode版本时,这不起作用,因为在最新版本中,它一切正常.
我有一个UITableViewCell
内部自定义的NIB文件.我不是子类UITableViewCell
.在我tableViewController
,我加载我的自定义UITableViewCell
并把它放在我的tableView
.但是当tableView
显示时,我的单元格的高度是标准的`UITableViewCell高度.为什么?在我的NIB文件中,高度为311.