English 中文(简体)
为什么要有一个单独的“主计长级”来影响以前的情况?
原标题:Why a separate instance of ViewController Class is affecting previous instance?

www.un.org/Depts/DGACM/index_spanish.htm UPDATE - Cause found! 请读到下文和增编;建议解决办法:

在制作录像以显示这一问题的同时,我发现为什么会发生这种情况。

<代码>#imports &@implementation DetailViewController.m上定义的任何控制/要素,均由原始密码丢失。 VC 创立了一个新案例。

Example: I am including a video that re-creates this issue. As shown, all controls work except a UISegmentedControl & a UILabel.. both of which are defined in DetailViewController.m as:

#import "DetailViewController.h"

UISegmentedControl *sortcontrol;
UILabel *incrementLabel;

@implementation DetailViewController

我认为我们相当接近。 放弃答案!

P.S.(以英语发言):我认为这一信息足以使我们找到解决办法,但如果需要,我也可以分享这一守则。


EARLIER:

There s a detailViewController (detVC) in our app which is normally pushed from a UITableViewController.

现在,我们也正在执行普什通知,在通知送达时,这些通知将以示范方式提出同样的标准,而这反过来又可能针对任何观点控制者。

在通过通知提交《刑法》之前,法庭进行所有罚款,而另一个《刑法》案则已经是执意的管制人(通过表文提早)。

问题发生时,所介绍的VC被解职——被推倒的VC松散地控制了所有东西——并没有提及早先和安放过的数据;甚至还有<代码>。 UISegmentedControl on Navigation Toolbar Point to -1index on press any index!

当我们制造一个单独的诽谤事件时,为什么会发生这样的事情。 VC? 为什么会影响较早的《刑法》? 这里需要了解目标C如何解决? (FYI,我们正在该项目中使用非洲资源中心)

增 编


EDIT - 一些法典:

shed:

ProductDetailViewController *detailViewController = [[ProductDetailViewController alloc] init];    
detailViewController.hidesBottomBarWhenPushed = YES;  
[self.navigationController pushViewController:detailViewController animated:YES];
detailViewController.serverOffset=serverOffset;
detailViewController.prdctIndex = indexPath.row;

通过通知提交:

- (void)displaySingleProduct:(NSDictionary*)userInfo{
    ProductDetailViewController *onePrdVC = [[ProductDetailViewController alloc] init];    
    UINavigationController *addNav = [[UINavigationController alloc] initWithRootViewController:onePrdVC];
    onePrdVC.justOne=YES;
    onePrdVC.onePrdIDtoLoad=[[[userInfo valueForKey:@"prd"] valueForKey:@"id"] intValue];
    [self.navigationController presentModalViewController:addNav animated:YES];
}

There is a Product class in detVC which gets the data from the values stored at the prdctIndex row in the SQLite table.

After dismissing the presented detVC through notification, the Product class of the pushed detVC starts pointing to the row which was used for Product class in presented detVC. And there is no such code in viewDidAppear which would alter Product class.

因此,以上和安普文提到的“IDSegmentedControl问题;其他一些问题正在造成痛苦! 基本上,整个排雷中心的行为是 we的,如果我们只是pop忙,则重新开展工作!


EDIT 2

I have more info on it which could lead to the cause. If I run viewDidLoad on viewDidAppear like this:

if (!justOne) {
    aProduct = [allProducts getProduct:(prdctIndex+1) one:NO];
    [self viewDidLoad];
    [self populateDetails];
}

the pushed detVC regains the control & every element/control starts re-working as expected (but not in the ideal way). So, it is quite clear that the separate instance of presented detVC does messes up the earlier pushed detVC & a re-setting up of all the controls / pointers is required through viewDidLoad.

能否从这一角度得出任何有益的结论?

最佳回答

在您的法典中,你写道:

#import "DetailViewController.h"

UISegmentedControl *sortcontrol;
UILabel *incrementLabel;

@implementation DetailViewController

You are not defining these variables as instance variables (ivars), so they are not individual for each instance. There are three ways to define ivars. 1) The traditional way, in your .h file.

@interface DetailViewController{
    UISegmentedControl *sortcontrol;
    UILabel *incrementLabel; 
}

2) 对目标C的一些补充增加了对今后两种方式的支持。 和在<代码>.m文档中申报。

@implementation DetailViewController{
    UISegmentedControl *sortcontrol;
    UILabel *incrementLabel;
}

3) 如果这些微粒使用财产来暴露这些财产,那么你就可以简单地排除这些财产的明确定义。 http://www.ohchr.org。

@interface DetailViewController
@property (strong, nonatomic) IBOutlet UISegmentedControl *sortcontrol;
@property (strong, nonatomic) IBOutlet UILabel *incrementLabel;

http://www.un.org/Depts/DGACM/index_chinese.htm

@implementation DetailViewController
@synthesize sortcontrol;
@synthesize incrementLabel;
问题回答

您是否从国家银行中装上了观点控制员? 如果是的话,每次都使用相同的观点控制器。 你可以把你的观察控制者的讲话记录下来,以便了解情况。

这实际上取决于如何建立你的评估结构。 如果你使用TabaController的申请, 这是这样做的适当方式。

如果同一类别中有两例相互干预,这强烈表明,你不会把所有的国家都储存在例如变量上。 我怀疑<代码>中的内容。 产品详细数据:在全球或阶级数据中储存其状况,并且你的问题在那里生活。

It s possible that you have done something silly like making ProductDetailViewController a forced singleton (overriding +alloc, which you should almost never do), but generally people remember when they ve done that.


从未直接打电话到<代码>viewDidLoad。 这只需要系统呼吁。 (我知道你只是测试,但没有留下。)

但是,在您的<条码>上,你是否打上了。 你们必须用这种方法来形容你。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签