我正在尝试投射我自己的自定义单元格,但似乎没有工作,我是IOS的新手和快速开发...从教程我看它工作正常但是当我尝试时,它给了我一个错误.
这是代码.
class UsersViewController: UIViewController, UITableViewDelegate, UITableViewDataSource{
@IBOutlet weak var resultTable: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
let height = view.frame.height
let width = view.frame.width
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 120
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell : ResultCell = UITableView.dequeueReusableCellWithIdentifier("userCell") as ResultCell
return cell
}
func tableView(tableView: UITableView, moveRowAtIndexPath sourceIndexPath: NSIndexPath, toIndexPath destinationIndexPath: NSIndexPath) { …Run Code Online (Sandbox Code Playgroud) 我正在关注斯坦福大学iOS讲座中的Trax应用程序演示,教师将应用程序设置为通过AirDrop处理GPX文件,但iPhone模拟器不支持AirDrop.
反正有没有将文件(更具体地说是GPX文件)添加到iPhone模拟器上的应用程序?我想过给自己发电子邮件并在模拟器上使用Safari,但我不知道它将存储在哪里或如何从Trax应用程序访问它.
我更新到Xcode 6.3,但现在我的项目(框架)将不再构建.这是一个纯粹的快速项目.我的所有文件都正确编译(选中"编译swift源文件"部分),但是我的测试(myProjectTests.xctest)出现链接错误:
Undefined symbols for architecture x86_64:
"__TWPSiSs10Comparable14MathEagleTests", referenced from:
__TFC14MathEagleTests11MatrixTests45testRandowWithDimensionsIntervalGeneratorInitfS0_FT_T_ in MatrixTests.o
__TFC14MathEagleTests11MatrixTests21testSubscriptRangeSetfS0_FT_T_ in MatrixTests.o
__TFC14MathEagleTests11MatrixTests35testSubscriptRowRangeColumnRangeSetfS0_FT_T_ in MatrixTests.o
__TFC14MathEagleTests11MatrixTests30testSubscriptRowRangeColumnSetfS0_FT_T_ in MatrixTests.o
__TFC14MathEagleTests11MatrixTests30testSubscriptRowColumnRangeSetfS0_FT_T_ in MatrixTests.o
__TFC14MathEagleTests11MatrixTests13testMatrixMapfS0_FT_T_ in MatrixTests.o
__TFC14MathEagleTests11MatrixTests24testMatrixMapPerformancefS0_FT_T_ in MatrixTests.o
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
奇怪的是,Comparable是一个快速的内置协议,所以我认为它与我的代码没有任何关系?所有引用都来自我的测试文件,因此它不是我的主要项目......
关闭ARC:
我使用创建自定义类的实例alloc,因此它的保留计数为1.
在下一行,我NSLog()实例(我description在我的自定义类中实现了一个方法).
在下一行,我释放了该对象.
在下一行,我再次NSLog()实例,即我发送description消息,我在控制台中看到相同的输出.我期待某种错误输出.
这是相关代码:
AppDelegate.m:
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
Greeter* host = [[Greeter alloc] initWithName:@"Maggie"]; //My custom class
NSLog(@"Greeter %@", host);
[host release];
NSLog(@"Greeter %@", host); //Create error: send a `description` message to an object whose retain count is 0.
return YES;
}
...
...
Run Code Online (Sandbox Code Playgroud)
Greeter.m:
...
- (NSString*)description {
return [
[[NSString alloc] initWithFormat:@"\n\tname: %@ \n\tCreated on %@", [self …Run Code Online (Sandbox Code Playgroud) 我正在使用XCode 6.3和Swift.
我刚在故事板中添加了一些视图控制器,并添加了自定义类并在身份检查器中设置了相应的自定义类.
但是当我运行应用程序时,它在Interface Builder文件中显示了未知的类X. 我无法与自定义类进行交互.这样的问题很少,我尝试了所有的解决方案,但没有一个能为我工作.
实际上有两个错误,第一个是:"隐式声明函数"class_getname"在c99中无效"
第二个是:不兼容的整数到指针转换使用类型'int'的表达式初始化'const char*'
我的方法是:
-(void) donneesrecoltees:(NSData *)donnees {
NSError *erreur;
NSNumber *lastMessage,*currentMessage;
//int i;
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSString *msg;
UIAlertView *alert;
NSDictionary *json=[NSJSONSerialization JSONObjectWithData:donnees options:0 error:&erreur];
// Check if it's the right class to avoid error stack
// this is the line that is causing the error
const char* className = class_getName([json class]);
NSString *myClass=[NSString stringWithFormat:@"%s",className];
....
}
Run Code Online (Sandbox Code Playgroud)
有关如何解决此问题的任何帮助?谢谢
我在xcode(Swift)中有一个项目.在一切都很完美之前.我只进入了AppStore并更新了Xcode.之后我将Xcode更新到版本6.3.1,我的项目显示了许多错误,如下图中的显示,每次我想运行它.怎么解决呢?

所有.在我的iOS应用程序中.在我的许多页面上Too many alerts and also with many Network conditions.
有太多警报文本,我厌倦了.每次我必须使用相同的代码.
我可以在某个帮助程序类中声明此代码吗?或者重复使用此代码?
-(BOOL)checkInternetAndlocationServices {
if(IS_INTERNET) {
if([CLLocationManager locationServicesEnabled] &&
[CLLocationManager authorizationStatus] != kCLAuthorizationStatusDenied){
return YES;
}
else
{
NSLog(@"Location services are disabled.");
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Location services are off." message:@"This app requires an Location services." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Location Services", nil];
[alert setTag:NO_LOCATIONSERVICES];
[alert show];
return NO;
}
}
else
{
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Internet connection is off." message:@"This app requires an internet connection and locations services, please enable internet connection …Run Code Online (Sandbox Code Playgroud) 我刚刚将我的xcode从6.2升级到6.4.早先iphone的模拟器尺寸很好.但现在iphone 5,5s,4s的尺寸非常大.现在我在水平和垂直两侧都有滚动条.我不知道为什么尺寸太大.如何解决这个问题?
我制作了一个名为Cocoa Touch Class BlackCircle的UILabel子视图,该子视图调用了drawRect()制作黑色圆形标签的方法。我将a UILabel拖到LaunchScreen.xib文件上,然后将Cocoa Touch Class File分配为的类时UILabel,出现错误-
“启动屏幕可能不使用”的实例
BlackCircle。
它在main.storyboard文件上工作正常,但在LaunchScreen.xib文件上不起作用。我怎样才能解决这个问题?谢谢!
xcode6 ×10
ios ×7
swift ×5
objective-c ×3
iphone ×2
xcode ×2
cocoa-touch ×1
gpx ×1
ios6 ×1
ios8 ×1
ipad ×1
storyboard ×1
uilabel ×1
uitableview ×1