标签: viewdidload

未调用 viewDidLoad

一切都在故事板中,使用非常标准的布局。 故事板图片

UISplitViewController使用详细视图控制器UINavigationController加载我的自定义UITableViewController. 只有viewDidLoad习惯中的UITableViewController永远不会触发。

viewWillAppear按预期触发,其他一切正常。视图显然已加载(唯一不起作用的是我在 中设置的通知viewDidLoad),我的回调在哪里?

我的viewDidLoad方法... viewDidLoad 代码 断点,NSLog...如果执行此方法,这些东西不可能不给我反馈。

uiviewcontroller viewdidload ios6

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

iOS:应用程序带到前台时刷新数据

我通过JSON从服务器上获取数据并将其显示在标签上.我在viewDidLoad中添加了该方法.

我想在用户再次打开应用程序时刷新数据.目前,即使我在模拟器中杀死应用程序并再次启动应用程序,它也不会刷新.

我尝试了viewDidAppear方法,但由于某种原因它没有被执行.

-(void)viewDidAppear{
        NSLog(@"Called viewDidAppear");
}
Run Code Online (Sandbox Code Playgroud)

从未调用过.我试图最小化应用程序但它不起作用.

viewdidload viewdidappear ios

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

如何在每次加载UIViewController时运行一个函数

我有这个功能:

func setMoneyValues() {
        balanceLabel.text = User.current.roundBalance()
        oweLabel.text = User.current.roundOwed()
        userLabel.text = User.current.roundUser()
    }
Run Code Online (Sandbox Code Playgroud)

我在viewdidload中执行.但是,它只被调用一次,如果我转到另一个选项卡(由选项卡栏控制器管理),更改值,并返回到此页面,值不会更新,因为该函数不会再次调用.每次重新打开标签时,我能做些什么才能调用它?

viewdidload swift

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

viewDidLoad 中的 EXC_BAD_ACCESS

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    @try {
        if ([segue.identifier isEqualToString:@"taskListSegue"])
        {   
            MindMapInformationViewController_iPhone *taskListContentController = [segue destinationViewController];  
            int selectedIndexPath = [[self.tableView indexPathForSelectedRow] row];

            MindMap *newMindMap;
            newMindMap = [mindmaps objectAtIndex:selectedIndexPath];        
            FileManager *fileManager = [[[FileManager alloc] init] autorelease];
            [fileManager readFile:newMindMap.pathToMindmapAtDevice parsing:YES];

            NSMutableArray *taskArray = [fileManager getArray];
            [taskListContentController setTasksOfSelectedMindmap:taskArray];
        }
    }
    @catch (NSException *exception) {

    }
}

-(void)setTasksOfSelectedMindmap:(NSMutableArray *)tasks {
    @try {
        [self initComponents];
        if (tasks != nil) {
            taskArray = tasks;
        }
    }
    @catch (NSException *exception) {

    }

}

-(void)initComponents {
    @try { …
Run Code Online (Sandbox Code Playgroud)

cocoa exc-bad-access objective-c super viewdidload

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

MPMoviePlayerController重复模式在viewDidLoad中不起作用

似乎我遇到了repeatmodeone的问题:它不重复视频.

这是我在实现中的视频代码:

- (void)viewDidLoad{

    NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Space Particle" ofType:@"mp4"]];


    MPMoviePlayerViewController *playerController = [[MPMoviePlayerViewController alloc]initWithContentURL:url];
    [self presentMoviePlayerViewControllerAnimated:playerController];
    [playerController.moviePlayer prepareToPlay];
    playerController.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
    playerController.moviePlayer.controlStyle = MPMovieControlStyleNone;
    playerController.moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
    playerController.moviePlayer.repeatMode = MPMovieRepeatModeOne;
    [MyView1 addSubview: playerController.view];


    [playerController.moviePlayer play];
    [playerController release];playerController=nil;
}
Run Code Online (Sandbox Code Playgroud)

它作为动画背景,上面有按钮.视频播放但是当它完成时,它不会重复播放.

我发现,作为一个IbAction,它重复,但作为viewDidLoad它没有.

请注意,"MyView"插座已链接到自定义UIButton,它位于电影播放的按钮视图中.

我正在使用的视频尺寸不大.

我的目标是电影必须重复使用viewdidload方法才能自动播放和重复.

拜托,我有什么问题吗?关于如何解决的建议?任何帮助,将不胜感激.

iphone xcode repeat mpmovieplayercontroller viewdidload

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

第二次Xcode没有调用ViewDidLoad

我有一个tableViewController,我从中导航到UIViewController.为了保存indexPath.row的值,我使用了一个整数,并基于该整数操作在UIViewController中执行.问题是,当我按下后退按钮并选择另一个表索引时,它会导航到UIViewContoller,但执行的操作是第一个.第二次不调用ViewDidLoad.这是我的代码.

TableView代码:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (!self.iaRecipieViewController) {
        self.iaRecipieViewController = [[[iRecipieViewController alloc] initWithNibName:@"iRecipieViewController" bundle:nil] autorelease];
    }
    if (indexPath.row == 0) {
        self.iaRecipieViewController.myLableArray =labelSoupArray ;
    }

    if (indexPath.row == 1) {
        self.iaRecipieViewController.myLableArray =labelSoupArray ;
    }

    if (indexPath.row == 2) {
        self.iaRecipieViewController.myLableArray =labelSoupArray ;
    }
    // custom string is an NSinteger
    self.iaRecipieViewController.customString = indexPath.row;
    NSLog(@"  int  %i",self.iaRecipieViewController.customString);
    NSLog(@"index path %i ", indexPath.row) ;

    [self.navigationController pushViewController:iaRecipieViewController animated:YES];

    [detailTable reloadData];
}
Run Code Online (Sandbox Code Playgroud)

UIViewController代码.

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional …
Run Code Online (Sandbox Code Playgroud)

uitableview uiviewcontroller viewdidload ios

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

[self viewDidAppear:YES];

是否[self viewDidAppear:YES];在码viewDidLoad中部分确保代码的viewDidAppear部分将运行?

基于我们用户的一小部分反馈,无论出于何种原因,我在主菜单视图的viewDidAppear部分中编写的代码都没有为它们运行 - 但它对大多数用户和所有用户都非常有效.我的测试.我希望通过添加[self viewDidAppear:YES]; 这将解决那些由于某种原因没有调用viewDidAppear的设备的问题...

你们有什么感想?

iphone viewdidload viewdidappear ipad

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

从视图开始的NStimer确实加载,给出错误的时间!客观C iPhone

我正在启动一个计时器,视图已加载

- (void)viewDidLoad
{
[super viewDidLoad];
locationManager.delegate = self;
[NSTimer scheduledTimerWithTimeInterval:10.0 //这里的间隔必须是一个浮动
目标:自
选择器:@selector(onTick :)
userInfo:nil重复:是];
}

然后我有我的计时器方法:

- (void)onTick:(NSTimer*)timer {
[locationManager startUpdatingLocation];

}

然后调用位置管理器,因为它是一个委托:

- (void)locationManager:(CLLocationManager*)manager
didUpdateToLocation :( CLLocation*)newLocation fromLocation:(CLLocation*)oldLocation {
NSLog(@"使其成为位置管理器");

NSTimeInterval timePassedSinceLastLocationUpdate = fabs([oldLocation.timestamp timeIntervalSinceNow]);

NSLog(@"更新时间:%f",timePassedSinceLastLocationUpdate);

的NSLog(@ "--------------");
//其他东西发生
[locationManager stopUpdatingLocation];
}

但是,显示的NSLOG是这样的:


2012-07-31 13:02:28.092 round5 [1713:f803]转发到位置经理
2012-07-31 13:02:28.095 round5 [1713:f803]更新时间:0.000000
2012-07-31 13:02: 28.095 round5 [1713:f803] --------------
2012-07-31 13:02:33.298 round5 [1713:f803]成为了位置经理
2012-07-31 13:02 :33.298 round5 [1713:f803]更新时间:5.222202
2012-07-31 13:02:33.300 round5 [1713:f803] --------------
2012-07-31 13:02 :44.086 round5 [1713:f803]转发到位置经理
2012-07-31 …

iphone objective-c nstimer viewdidload

-1
推荐指数
1
解决办法
628
查看次数