我知道我们可以使用创建电影播放器initWithContentURL:,我们可以传递NSUrl参数.这里我没有NSUrl,我只有NSData.通过使用它我可以创建电影播放器吗?
当使用objective-c时,有许多不同的方法可以偶然发现将使用withObject的东西.performSelectorOnMainThread就是一个很好的例子.
[self performSelectorOnMainThread:@selector(aSelector) withObject:anObject waitUntilDone:YES];
Run Code Online (Sandbox Code Playgroud)
这将使用对象anObject调用选择器aSelector.我经常发现自己有一个选择器,它采用一个简单的数据类型,如int或enum,我想把它传递给'withObject'.这样做的正确方法是什么?
我正在创建一个iOS应用程序,当分数达到100时,此警报将显示并且一切正常,但按钮(分享,苹果,评价此应用程序).
- (void) buttonAction {
counter++;
if(counter == 100)
[self showAlert];
}
- (void) showAlert {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"hello"
message:@"whats you name"
delegate:nil
cancelButtonTitle:@"Dismiss"
otherButtonTitles:@"share", @"apple" , @"rate this app", nil];
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0) { // means share button pressed
// write your code here to do whatever you want to do once the share button is pressed
}
if(buttonIndex == 1) { // means apple button pressed
// write your code here …Run Code Online (Sandbox Code Playgroud) 当我将UIColor对象添加到数组中时,我收到了Thread1: Program received signal: “SIGBRT”此错误.
NSMutableArray *array =[[NSMutableArray alloc] init];
UIColor *color1,*color2, *color3,*color4;
color1 = [UIColor blueColor];
color2 = [UIColor colorWithHue:0.5
saturation:0.1
brightness:0.2
alpha:1.0];
color3 = color2;
[array addObject:color1];//No Problem
[array addObject:color2];//No Problem
[array addObject:color3];//No Problem
[array addObject:color4];//Problem is here.....
Run Code Online (Sandbox Code Playgroud)
当我将前三个对象添加到数组中时没有问题.但是当我添加最后一个对象时,我得到错误.这段代码有什么问题?我应该像前三个对象一样将任何东西分配给第四个对象(color4)吗?有必要吗?为什么?...
请举例说明.提前致谢.
我已经标记了给我带来麻烦的那条线
private void EditButtonActionPerformed(java.awt.event.ActionEvent evt) {
Run Code Online (Sandbox Code Playgroud)
DefaultListModel PatientListModel = new DefaultListModel();
for (Patient s : PatientList) {
int AccNum = Integer.parseInt(IDTextField.getText());
if (AccNum == s.getAccountNumber()) {
s.setName(NameTextField.getText());
s.setAge(Integer.parseInt(AgeTextField.getText()));
s.setAddress(AddressTextField.getText());
String PatientSex = "";
if (MaleRadioButton.isSelected()) {
PatientSex = "Male";
}
if (FemaleRadioButton.isSelected()) {
PatientSex = "Female";
}
s.setSex(PatientSex);
s.setPhone(PhoneTextField.getText());
ArrayList<PatientCondition> PatientConditions3 = new ArrayList();
===> PatientConditions3 = (ArrayList<PatientCondition>) ConditionsJList.getSelectedValuesList(); //error here
s.setConditionsList(PatientConditions3);
PatientInfoLabel2.setText("Patient Details Updated");
for (Patient f : PatientList) {
PatientListModel.addElement(f.getAccountNumber() + "-" + f.getName());
}
PatientJList.setModel(PatientListModel);
UpdateAllViews();
// …Run Code Online (Sandbox Code Playgroud) 我已经在我的项目中编写了代码,但没有任何错误,但每当我运行程序时,它都会显示错误.我不明白我在哪里可以检查这些错误.请有人帮帮我.
Ld /Users/colors/Library/Developer/Xcode/DerivedData/Testpicker-dpwydhrdvihgeafvbusqpriesfgj/Build/Products/Debug-iphonesimulator/Testpicker.app/Testpicker normal i386 cd/Users/colors/Desktop/prasad/Testpicker 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/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/colors/Library/Developer/Xcode/DerivedData/Testpicker-dpwydhrdvihgeafvbusqpriesfgj/Build/Products/Debug-iphonesimulator -F/Users/colors/Library/Developer/Xcode/DerivedData/Testpicker-dpwydhrdvihgeafvbusqpriesfgj/Build/Products/Debug-iphonesimulator -filelist/Users/colors/Library/Developer/Xcode/DerivedData/Testpicker-dpwydhrdvihgeafvbusqpriesfgj/Build /中间体/ Testpicker.build /调试-iphonesimulator/Testpicker.build /对象 - 正常/ I 386/Testpicker.LinkFileList -mmacosx-version-min = 10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED = 50000 -framework CoreVideo -framework AVFoundation -framework UIKit -framework CoreGraphics -o/Users/colors /库/开发商/ Xcode中/ DerivedData/Testpicker-dpwydhrdvihgeafvbusqpriesfgj /编译/产品/调试-iphonesimulator/Testpicker.app/Testpicker`
Undefined symbols for architecture i386:
"_objc_autoreleasePoolPush", referenced from:
_main in main.o
"_objc_msgSend", referenced from:
_main in main.o
-[ViewController viewDidLoad] in ViewController.o
-[ViewController changeImage] in ViewController.o
-[ViewController grabImage] …Run Code Online (Sandbox Code Playgroud) 有什么办法addObjectFromArray:atIndex:吗?
我有2个NSMutableArrays.让我们说第一阵列是array1第二阵容array2.他们充满了价值观.我需要从项目添加array1索引3到array2.可能吗?
我有两个视图控制器和笔尖.我用一个切换开关填充了一个视图控制器,并在其头文件中声明了这一点:
@public UISwitch *toggleSwitch;
Run Code Online (Sandbox Code Playgroud)
并将其暴露为这样的属性:
@property (nonatomic,retain) IBOutlet UISwitch *toggleSwitch;
Run Code Online (Sandbox Code Playgroud)
我还将开关与toggleSwitch插座连接起来.然后我在我的其他视图控制器中使用此开关,如下所示:
theViewControllerWhereIDeclaredTheSwitch.toggleSwitch.on = YES;
Run Code Online (Sandbox Code Playgroud)
虽然默认情况下开关处于开启状态时一切正常,但是当我关闭开关时,它会在main.m文件中引发异常:"线程1:信号SIGABRT".我在使用Xcode时经常遇到这个错误,这个错误真是我的屁股.请帮忙.
我正在开发一个应用程序.. 一个小问题是,我们在这里使用一个 TabBarController 应用程序。我们在选项卡菜单中添加了一些导航控制器,我们成功完成了。一个要求是在最后一个 tabBarButton 中我们添加了一个更多按钮。但它不是一个视图。只是一个简单的按钮。当我们按下这些按钮时,它们会执行某些操作。我试过了,但不是从我这边完成的。有你给我一些指导.. 提前致谢..