logo
down
shadow

after dismissing a viewController, the contentOffset from my tableView was changed to (0, -64)


after dismissing a viewController, the contentOffset from my tableView was changed to (0, -64)

By : cjwhai
Date : November 19 2020, 12:41 AM
it should still fix some issue The following code is not working.It makes tableview to move from (0,0) content offset to (0,-64) content offset.
code :
self.navigationcontroller.navigationbar.transculent = NO;
[[UINavigationBar appearance]setTransculent:NO];


Share : facebook icon twitter icon
Is it possible to add observer to tableView.contentOffset?

Is it possible to add observer to tableView.contentOffset?


By : Vishal Khanna
Date : March 29 2020, 07:55 AM
will help you UITableView is a UIScrollView subclass so you can use the UIScrollViewDelegate method scrollViewDidScroll: to be notified when the view scrolled. Check the contentOffset of the scrollView in that method
contentOffset is a key path, so you can also observe its changes using KVO
code :
[self.tableView addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil];
Delete row and object from tableView when dismissing ViewController

Delete row and object from tableView when dismissing ViewController


By : sneha pallapotu
Date : March 29 2020, 07:55 AM
hop of those help? You could do something like the following, it will only get new Parse data when the view is loaded to save constant Parse calls (then add a UIRefreshControl so you can pull to reload the data) and will remove the object before the table is next shown.
ResponsesViewController.m
code :
@interface ResponsesViewController ()
@end
@implementation ResponsesViewController

- (void)viewDidLoad
{
  [super viewDidLoad];
  [self loadParseData];
}

-(void)viewDidAppear:(BOOL)animated{
   [super viewDidAppear:animated];
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated]
    [self.tableView reloadData];
} 

-(void)loadParseData {
//getting the objects from parse.com
    PFQuery *query = [PFQuery queryWithClassName:@"smajlici"];
    [query whereKey:@"recieverFacebookiD" equalTo:[[PFUser currentUser] objectForKey:@"fbId"]];
    [query orderByAscending:@"createdAt"];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (error){
            NSLog(@"current user is %@", error);
        } else {
//adding objects from server into MutableArray
            self.responses = [objects mutableCopy];
            [self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
        }
    }];
}


//------------------------------------------

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 69;
}
//------------------------------------------
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
//------------------------------------------
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [self.responses count];
}
//------------------------------------------

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"responseCell" forIndexPath:indexPath];
    PFObject *object      = [self.responses objectAtIndex:indexPath.row];

    cell.textLabel.text   = [object objectForKey:@"senderFbName"];

    return cell;
}
//------------------------------------------

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    self.selectedResponse = [self.responses objectAtIndex:indexPath.row];
    [self.responses removeObject:self.selectedResponse];
    [self performSegueWithIdentifier:@"detailResponse" sender:self];
}
//------------------------------------------

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{

//sending object to DetailResponsesVC

    if ([segue.identifier isEqualToString:@"detailResponse"]) {
        DetailResponsesViewController *controller = (DetailResponsesViewController *)segue.destinationViewController;
        controller.selectedResponse               = self.selectedResponse;                                
    }
}


@end
Need assistance dismissing modally presented ViewController and popping ViewController from UINavigationController

Need assistance dismissing modally presented ViewController and popping ViewController from UINavigationController


By : Max Küper
Date : March 29 2020, 07:55 AM
will help you First check if you have presentedViewController in V2, if you do, then dismiss it and in completion block perform the segue, otherwise perform the segue directly,
code :
-(void)goBackToV1 {
    NSLog(@"goBackToV1");
    if(self.presentedViewController) {
        [self dismissViewControllerAnimated:YES completion:^{
            [self performSegueWithIdentifier:@"uwid" sender:nil];
        }];     
    } else {
        [self performSegueWithIdentifier:@"uwid" sender:nil];
    }
}
can't get contentOffset of tableView

can't get contentOffset of tableView


By : Malik Arzish Hussain
Date : March 29 2020, 07:55 AM
it helps some times you can set content offset for UITableView like below, that will scroll your tableview:
code :
CGPoint Offset = CGPointMake(0, 60);//pass your values here.
[tableView setContentOffset:Offset animated: YES];
[tableView setContentOffset:CGPointMake(0, 60) animated: YES];
Swift - Reload TableView After Dismissing Modal ViewController

Swift - Reload TableView After Dismissing Modal ViewController


By : user3451157
Date : March 29 2020, 07:55 AM
hop of those help? I'm showing a View Controller as a Popup on a Parent ViewController(VC). , ParentVC.swift
code :
@IBAction func searchButton(_ sender: Any) {
    let searchPatientVC = self.storyboard?.instantiateViewController(withIdentifier:"SearchVC") as? UISearchViewController
    searchPatientVC!.modalTransitionStyle   = .crossDissolve
    searchPatientVC!.modalPresentationStyle = .overCurrentContext
    searchPatientVC.searchCompletion = {(model,flag) in
   if(flag){
    self.updatePatientSearch22(json:model)
    self.logBookTableView.reloadData()

   }
 }
    self.present(searchPatientVC!, animated: true, completion: nil)

}
typealias completion = (NSArray,Bool)->Void
var searchCompletion:completion!


@IBAction func submitButtonAction(_ sender: Any) {
    showToast(message: "Submit func calling", font: UIFont.systemFont(ofSize: 15))
    getPatientData() { value in

     self.dismiss(animated: true, completion: nil)
    self.searchCompletion(value,true)


}    

}
Related Posts Related Posts :
  • Looking for simplest option to render Razor cshtml pages in a console application without any web server
  • Evaluating variables at a specific time in Modelica
  • When I run the Application, only "web" engine is running in GlassFish. "webservices" is not started
  • How To Set MIME Type Of Google Drive File
  • Remove Missing Values in Weka
  • Reloading a UICollectionView using reloadData method returns immediately before reloading data
  • carrot2 - can I cluster documents from a folder?
  • StreamSocket has no Close Implementation in C#
  • Rails, Foundation 4, Respond.js not working properly in IE8
  • How can i create imagesurface from cairo xlib's Graphics Context using cairo and x11 Api's?
  • CKEditor "overflow: scroll" on parent causes toolbar to freeze at initial position
  • Differences between components and controls in ENYO
  • Photoshop making isometric?
  • Does Intel IPP 8.0 support in-place operations?
  • What is Object dictionary in CANOpen?
  • Example of orbBasic Indexed User Variables
  • convert to ABSOLUTE in logback
  • How to conditionally download file using p:fileDownload
  • Error on pod install
  • Set HTTP GET Parameters in Finagle
  • different attack that uses sql injection
  • How can I change my xampp username not as 'root'
  • AMQP Content header payload structure
  • Apache POI formula evaluation not working for Excel IF
  • How can I trace RESTEasy's dispatch?
  • Map Freezes on iOS 7 with Google Maps SDK 1.4
  • Comparing lists, is the subset list within the first list
  • Non-ascii character highlight in Sublime Text 2
  • Installing Magit in Aquamacs
  • Receiving error - System.Net.Mail.SmtpException: 4.3.2 try again later
  • Coreaudio render callback in monotouch
  • The command 'yarn --v' also initiates 'yarn install' and installs packages automatically. Why is this happening?
  • save multiple matches in a list (grep or awk)
  • Can a number register be used in a groff request?
  • Mapping FAQ with RASA for large dataset (2000+)
  • Fragment not receiving LiveData updates after remove + add
  • FitText.js makes text bigger rather than smaller
  • ARM - Implementing stack with load/store multiple register values
  • How to check if a ChromeCast Session is already in progress
  • ngForm inside a Carousel Slide in UI Bootstrap not working
  • Clearing attributes in Tritium
  • "vagrant up" failing: Vagrant VM failed to remain in the running state
  • ftsearch returning empty docs
  • What are the advantages of setting "hive.exec.parallel" to false in Hive ?
  • Creating a root certificate in FiddlerCore
  • How to access app.config in a blueprint?
  • DB2 RECORDSET table name converted to uppercase
  • Resizing the superview according to the subviews
  • IExpress - Disable Compression
  • Getting InvalidProtocolBufferException while running oozie job
  • What are the differences between Play run and start?
  • How can I share props in ReasonReact?
  • Task.Delay is skipped
  • Parsley.js Password Confirm doesn‘t work
  • How to get all registred 'browser:resource' in Plone
  • Overriding page_list controller inside a package in Concrete5.6.1.2
  • Robolectric 2.x - dependent jars are downloading while running the tests
  • Setting Flyout to Main Frame Navigation(Windows 8.1 app store)
  • Build project - Nuget Error
  • How to recover admin password for SonarQube
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org