对不起另一个新手问题.
我试图在viewDidLoad中获取后退按钮文本值,但是当我浏览控制器时它总是显示为null.
NSLog(@"-----------> %@ ", self.navigationItem.backBarButtonItem.title);
Run Code Online (Sandbox Code Playgroud)
如何获取后退按钮文本值?
我是iphone开发的新手.我有一个问题.我想在NSString中转换NSTimeInterval值,但在此不成功.请快速查看下面的代码.
在.h
NSTimeInterval startTime;
NSTimeInterval stopTime;
NSTimeInterval duration;
Run Code Online (Sandbox Code Playgroud)
在.m
startTime = [NSDate timeIntervalSinceReferenceDate];
stopTime = [NSDate timeIntervalSinceReferenceDate];
duration = stopTime-startTime;
NSLog(@"Duration is %@",[NSDate dateWithTimeIntervalSinceReferenceDate: duration]);
NSLog(@"Duration is %@", [NSString stringWithFormat:@"%f", duration]);
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
NSString *time = [dateFormatter stringFromDate:duration];----> Error
[dateFormatter release];
Run Code Online (Sandbox Code Playgroud)
并在一个标签上设置此字符串----
[timeLabel setText:time];
Run Code Online (Sandbox Code Playgroud)
但它不起作用它显示错误:'stringFromDate:'的参数1的不兼容类型
如果我评论该行,它会在控制台窗口中显示正确的持续时间.
谢谢你的帮助.
我尝试在我的应用程序中播放一些音频,它工作正常3次.但是当我试图在第四次播放时它会显示错误.错误域= NSOSStatusErrorDomain代码= -43"操作无法完成.(OSStatus错误-43.)".代码是
NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/Sun.wav", [[NSBundle mainBundle] resourcePath]]];
NSError *error;
AudioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
AudioPlayer.numberOfLoops = 0;
AudioPlayer.volume=1.0;
if (AudioPlayer == nil)
{
NSLog([error description]);
}
else
[AudioPlayer play];
Run Code Online (Sandbox Code Playgroud)
有人在......之前搞清楚了吗?
我不确定我的英语,但我需要得到整数的单位数.没有复杂的算法,但有一些API或其他技巧.
例如 :
int a= 53;
int b=76;
Run Code Online (Sandbox Code Playgroud)
我添加,因为我几乎总是"不符合质量标准"发布!它让我疯狂!拜托,修理吧!它花了10次拍摄发布这个,还有其他问题.
我需要得到a=3和b=6在一个简单巧妙的方法.
其他数字相同.
非常感谢 .
我正在使用UITableView属性来编辑它.theTableView.editing = YES; theTableView.allowsSelectionDuringEditing = YES;
它工作正常,行被选中,我进入下一个控制器,但我需要在行中显示accessoryType.我正在使用下面的线,但即使它不起作用.是否有任何财产或任何遗失的东西显示印度人.
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
我使用下面的代码表格视图.
theTableView = [[UITableView alloc] initWithFrame:tableRect style:UITableViewStyleGrouped];
theTableView.editing = YES;
theTableView.allowsSelectionDuringEditing = YES;
theTableView.delegate = self;
theTableView.dataSource = self;
theTableView.scrollEnabled=YES;
theTableView.separatorColor = [UIColor lightGrayColor];
theTableView.autoresizingMask=YES;
theTableView.allowsSelection=YES;
theTableView.sectionHeaderHeight=5;
theTableView.sectionFooterHeight=5;
[myView addSubview:theTableView];
Run Code Online (Sandbox Code Playgroud)
请帮我.
谢谢你,Madan Mohan
我有找到DHCP地址和主机地址的方法.如何查找分配给我的设备的动态IP地址.我可以从http://www.ip2location.com/default.aspx获取地址
如何在设备中获取此IP?
在我的程序中,如果我将下面的行放在cellForRowAtIndexPath(Tableview)中,滚动就可以了.否则,线路崩溃.我想知道这段代码做了什么?
代码是......
for (UIView *oldViews in cell.contentView.subviews)
{
[oldViews removeFromSuperview];
}
Run Code Online (Sandbox Code Playgroud)
提前致谢
NSDateFormatter *isoDateFormatter = [NSDateFormatter new];
[isoDateFormatter setDateFormat:@"yyyy-MM-dd"];
[isoDateFormatter setTimeZone:[NSTimeZone systemTimeZone]];
[isoDateFormatter setFormatterBehavior:NSDateFormatterBehaviorDefault];
NSString * str = [isoDateFormatter dateFromString:@"2008-12-31T12:00:00"]
Run Code Online (Sandbox Code Playgroud)
在4.0 IOS上面的代码即str是nill,在3.0 IOS上这个工作正好是2008-12-31.如何克服这个问题?
使用UIBezierPath进行线条绘制的简单应用程序,但现在需要一种方法来擦除使用UIBezierPath绘制的线条.有没有办法实现橡皮擦功能去除线条画?
我正在构建一个ARC iphone应用程序,并即将集成addThis ios库.
我收到以下错误:
ld: duplicate symbol _OBJC_CLASS_$_Facebook in /Users/mars/Desktop/Pst/trunk/Pst/ThirdPartyLibs/FBConnect/FacebookSDK/FacebookSDK.framework/FacebookSDK(Facebook.o) and /Users/mars/Library/Developer/Xcode/DerivedData/Pst-bqmphjiqldalzsankfvxugsurcdj/Build/Intermediates/Pst.build/Debug-iphonesimulator/Pst.build/Objects-normal/i386/Facebook.o for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
我用我的编译资源进行了双重检查,只有1个facebook.m存在.
我还在这些库文件的编译器标志中加入了"-fno-objc-arc",因为它们是在没有ARC的情况下构建的
任何帮助将非常感激!!
iphone ×6
objective-c ×5
addthis ×1
android ×1
cocoa-touch ×1
indicator ×1
ios4 ×1
networking ×1
uitableview ×1
uiview ×1