小编DSh*_*hah的帖子

NSMutableArray和NSDictionary的内存泄漏

我有一个memomry泄漏问题,也许有人可以帮助我.我尝试为pList加载NSMutable数组并在TablevView中显示一些元素

在h.File我宣布

@interface Bestellung : UIViewController <UITableViewDelegate, UITableViewDelegate> {

NSMutableArray *bestellteVorspeisen;
NSMutableArray *bestellteVorspeisenPreis;
NSMutableArray *bestellteVorspeisenDetails;
NSMutableArray *bestellteVorspeisenBild;
NSMutableArray *bestellteVorspeisenNummer;

NSMutableArray *bestellListe;


IBOutlet UITableView *myTable; 


}
@property (nonatomic, retain) NSMutableArray *bestellListe;

@property (nonatomic,retain) NSMutableArray *bestellteVorspeisen;
@property (nonatomic,retain) NSMutableArray *bestellteVorspeisenPreis;
@property (nonatomic,retain) NSMutableArray *bestellteVorspeisenDetails;
@property (nonatomic,retain) NSMutableArray *bestellteVorspeisenBild;
@property (nonatomic,retain) NSMutableArray *bestellteVorspeisenNummer;

@end
Run Code Online (Sandbox Code Playgroud)

在M.File viewDidLoad中,我在bestellListe中加载了pList

NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"Bestellung.plist"];
    success = [fileManager fileExistsAtPath:filePath];
    if (!success) …
Run Code Online (Sandbox Code Playgroud)

cocoa memory-leaks objective-c nsdictionary

0
推荐指数
1
解决办法
1349
查看次数

为什么NSArray确实有indexOfObject方法而NSMutableArray没有?

我想从a中删除一个特定元素NSMutableArray,我看到NSArray有indexOfObject一个对此非常有用的方法,但NSMutableArray没有.

我目前的方法是使用removeObjectsInArray方法NSMutableArray作为参数传递包含我的object/s的数组.

有没有更好的方法呢?有什么理由NSMutableArray没有这种方法吗?

iphone objective-c nsmutablearray nsarray

0
推荐指数
1
解决办法
609
查看次数

目标c中指针转换的无效整数

当我构建这个代码时,我得到WARNING,INVALID Integer指针转换.但是当我运行应用程序时它会崩溃.....

任何人都可以帮助我...我在withObject收到警告:[发送者标签]

我有frontButtonScaleUp方法,它接受(NSIngeter)参数...并且标签返回NSInteger值...

- (IBAction)frontButtonReleased:(id)sender
{
    const double delay = 0.3;
    double elapsed = CACurrentMediaTime() - tapStartTime;;
    if (elapsed >= delay)
        [self frontButtonScaleUp:[sender tag]];
    else
        [self performSelector:@selector(frontButtonScaleUp) withObject:[sender tag] afterDelay:delay - elapsed];
}
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch objective-c nsinteger

0
推荐指数
1
解决办法
5970
查看次数

使用C文件处理更改本地路径上的文件名?

FILE *fp;
fp=fopen("c:\\test.txt", "r");
int fgetc (FILE *fp);
int fputc( int c, FILE *fp );
Run Code Online (Sandbox Code Playgroud)

有没有办法更改计算机中已存在的文件名?如果是,那么我该如何引用该文件?使用指针我们只能引用文件的内容...所以有没有引用文件名的方法??? 这是我如何引用C中的文件:

c file-io file

0
推荐指数
1
解决办法
1438
查看次数

从父/基类到子类的Swift类型转换

我有父/基类如下:

class Base {
    ...
}
Run Code Online (Sandbox Code Playgroud)

另外,如下所示:

class Child: Base {
    ...
    func someFunc() {

    }
}
Run Code Online (Sandbox Code Playgroud)

我已经创建了Parent类的实例,如下所示:

let baseObj = Base()
Run Code Online (Sandbox Code Playgroud)

现在,我想从父对象中调用Child类的方法.所以我有如下代码:

let childObj = baseObj as! Child
childObj.someFunc()
Run Code Online (Sandbox Code Playgroud)

但是这给我的运行时崩溃如下:

Could not cast value of type 'PCTests.Base' (0x11c6ad150) to 'PCTests.Child' (0x11c6ab530).
Run Code Online (Sandbox Code Playgroud)

oop inheritance ios swift

0
推荐指数
1
解决办法
3808
查看次数