logo
down
shadow

Turn off UITableView bottom/top gradient mask on tvOS?


Turn off UITableView bottom/top gradient mask on tvOS?

Content Index :

Turn off UITableView bottom/top gradient mask on tvOS?
Tag : development , By : Bas
Date : November 24 2020, 09:00 AM

seems to work fine On tvOS, UITableView applies a nice looking gradient mask to the top and bottom of the view. In most instances this is the desired appearance, but in some cases it is not. Is there a way to conditionally turn that off? If there isn't an official way of doing this, has anyone found an indirect way of removing that effect? , You can disable it with the following:
ObjC:
self.tableView.maskView = nil;  
self.tableView.mask = nil

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Using UIGradientLayer as layer.mask to fade out bottom / top of a scrollview --> repositioning of mask is lagging beh


Tag : iphone , By : Dominique Vocat
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further Referring to this article http://cocoawithlove.com/2009/08/adding-shadow-effects-to-uitableview.html you have to surround your frame changes like this:
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];

// Set the frame

[CATransaction commit];

UITableView and new methods for tvOS


Tag : ios , By : Joshua Johnson
Date : March 29 2020, 07:55 AM
this will help If you want to change image when UITableViewCell item get focus, then you should use second method.
 - (void)tableView:(UITableView *)tableView didUpdateFocusInContext:(UITableViewFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
{
   //You can get focused indexPath like below
   NSIndexPath *nextIndexPath = [context nextFocusedIndexPath];
   // Now get image from data source, I will assume you have an images array
   UIImage *image = [_imagesArray objectAtIndex:nextIndexPath.row];
   // Set image to image view, assuming you have a property imageView
   _imageView.image = image;
}

Add Search to tvOS UITableView


Tag : objective-c , By : rhyhann
Date : March 29 2020, 07:55 AM
will help you Ok, so after an all-day event of me banging my head into a brick wall, I finally got it set up. Just a note, I HATE how Apple's tutorial and Sample Code for this makes it overly complex. They add in an NSObject of APLProducts, a BaseTableView, and make several compound NSPredicates inside their tutorial for making use of search in a TableView. Could have been much simpler.
In the end, there were only 3 classes needed:
-(void)viewDidLoad {
    [super viewDidLoad];
    _resultsTableController = [[APLResultsTableController alloc] init];
    _searchController = [[UISearchController alloc] initWithSearchResultsController:self.resultsTableController];
    self.searchController.searchResultsUpdater = self;
    [self.searchController.searchBar sizeToFit];
    self.tableView.tableHeaderView = self.searchController.searchBar;

    self.resultsTableController.tableView.delegate = self;
    self.searchController.delegate = self;
    self.searchController.searchBar.delegate = self; // so we can monitor text changes + others


    self.definesPresentationContext = YES;  // know where you want UISearchController to be displayed

}
- (void)viewWillAppear:(BOOL)animated {
    if (self.searchControllerWasActive) {
        self.searchController.active = self.searchControllerWasActive;
        _searchControllerWasActive = NO;

        if (self.searchControllerSearchFieldWasFirstResponder) {
            [self.searchController.searchBar becomeFirstResponder];
            _searchControllerSearchFieldWasFirstResponder = NO;
        }
    }
    NSBundle *bundle = [NSBundle mainBundle];

    self.files  = [bundle pathsForResourcesOfType:@"pdf" inDirectory:@"AIMPDF"];
    NSString *documentsDirectoryPath = [self.files objectAtIndex:thepath.row];

    self.title = @"Devo Songs";
    self.filenames = [[documentsDirectoryPath lastPathComponent] stringByDeletingPathExtension];
    NSLog(@"%@", filenames);

    NSMutableArray *names = [NSMutableArray arrayWithCapacity:[self.files count]];
    for (NSString *path in self.files) {
        [names addObject:[[path lastPathComponent] stringByDeletingPathExtension]];
    }
    self.files = names;


    self.tableView.backgroundColor = [UIColor whiteColor];
    self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"iphonebackground.png"]];
    [super viewDidLoad];


    [super viewWillAppear:animated];

}
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
    [searchBar resignFirstResponder];
}

- (void)updateSearchResultsForSearchController:(UISearchController *)searchController {
    // update the filtered array based on the search text
    NSString *searchText = searchController.searchBar.text;
    NSMutableArray *searchResults2 = [self.files mutableCopy];

    // strip out all the leading and trailing spaces
    NSString *strippedString = [searchText stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];

    // break up the search terms (separated by spaces)
    NSArray *searchItems = nil;
    if (strippedString.length > 0) {
        searchItems = [strippedString componentsSeparatedByString:@" "];
    }



    for (NSString *searchString in searchItems) {

        NSPredicate *sPredicate =
        [NSPredicate predicateWithFormat:@"SELF contains[c] %@", searchString];
        [searchResults2 filterUsingPredicate:sPredicate];


    }


    // hand over the filtered results to our search results table
    APLResultsTableController *tableController = (APLResultsTableController *)self.searchController.searchResultsController;
    tableController.filteredProducts = searchResults2;
    [tableController.tableView reloadData];
}

- (void)handleSearchForTerm:(NSString *)searchTerm
{
    [self setSavedSearchTerm:searchTerm];

    if ([self searchResults] == nil)
    {
        NSMutableArray *array = [[NSMutableArray alloc] init];
        [self setSearchResults:array];
        array = nil;
    }

    [[self searchResults] removeAllObjects];

    if ([[self savedSearchTerm] length] != 0)
    {
        for (NSString *currentString in [self files])
        {
            if ([currentString rangeOfString:searchTerm options:NSCaseInsensitiveSearch].location != NSNotFound)
            {
                [[self searchResults] addObject:currentString];
            }
        }
    }
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    // Return the number of sections.
    return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    // Return the number of rows in the section.
    NSInteger rows;

        rows = [[self files] count];
    return rows;
}


// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *filename = [[[self.files objectAtIndex:indexPath.row] lastPathComponent] stringByDeletingPathExtension];
    NSInteger row = [indexPath row];
    NSString *contentForThisRow = nil;


        contentForThisRow = filename;

    static NSString *CellIdentifier = @"CellIdentifier";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }


           [[cell textLabel] setText:contentForThisRow];
        cell.textLabel.font = [UIFont fontWithName:@"Helvetica Neue" size:90];
        cell.textLabel.textColor = [UIColor blackColor];
        cell.backgroundColor = [UIColor lightGrayColor];
        return cell;

}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    self.selectedCountry = (tableView == self.tableView) ?
    self.files[indexPath.row] : self.resultsTableController.filteredProducts[indexPath.row];

    [self performSegueWithIdentifier:@"ShowSong" sender:self];




}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Make sure your segue name in storyboard is the same as this line
    if ([[segue identifier] isEqualToString:@"ShowSong"])
    {

        NSLog(@"Selecting %@", self.selectedCountry);
        FirstViewController* userViewController = [segue destinationViewController];
        userViewController.selectedCountry = self.selectedCountry;

        //if you need to pass data to the next controller do it here
    }
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.filteredProducts.count;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    self.selectedCountry = [self.filteredProducts objectAtIndex:indexPath.row];

    [self performSegueWithIdentifier:@"ShowSong" sender:self];




}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Make sure your segue name in storyboard is the same as this line
    if ([[segue identifier] isEqualToString:@"ShowSong"])
    {

        NSLog(@"SelectingSearch %@", self.selectedCountry);
        FirstViewController* userViewController = [segue destinationViewController];
        userViewController.selectedCountry = self.selectedCountry;

        //if you need to pass data to the next controller do it here
    }
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *filename = [[[self.filteredProducts objectAtIndex:indexPath.row] lastPathComponent] stringByDeletingPathExtension];
    NSInteger row = [indexPath row];
    NSString *contentForThisRow = nil;


    contentForThisRow = filename;

    static NSString *CellIdentifier = @"CellIdentifier";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }


    [[cell textLabel] setText:contentForThisRow];
    cell.textLabel.font = [UIFont fontWithName:@"Helvetica Neue" size:90];
    cell.textLabel.textColor = [UIColor blackColor];
    cell.backgroundColor = [UIColor lightGrayColor];
    return cell;

}


@end

How to replace bottom colour from black gradient to white gradient?


Tag : ios , By : Patastroph
Date : March 29 2020, 07:55 AM
Hope this helps I have created an IBDesignable class for color picker tool. Like below , Try
override func draw(_ rect: CGRect) {
        let context = UIGraphicsGetCurrentContext()
        for y : CGFloat in stride(from: 0.0 ,to: rect.height, by: elementSize) {
            var saturation = y < rect.height / 2.0 ? CGFloat(2 * y) / rect.height : 2.0 * CGFloat(rect.height - y) / rect.height
            saturation = CGFloat(powf(Float(saturation), y < rect.height / 2 ? saturationExponentTop : saturationExponentBottom))
            let brightness = CGFloat(1.0)

            for x : CGFloat in stride(from: 0.0 ,to: rect.width, by: elementSize) {
                let hue = x / rect.width
                let color = UIColor(hue: hue, saturation: saturation, brightness: brightness, alpha: 1.0)
                context!.setFillColor(color.cgColor)
                context!.fill(CGRect(x:x, y:y, width:elementSize,height:elementSize))
            }
        }
    }
 let brightness = CGFloat(1.0)

UITableView with Transparent Gradient at Top and Bottom


Tag : iphone , By : Angel Paunchev
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Removed widget remains on parent
  • setup saga middleware with redux-starter-kit's configureStore()
  • How to get cookies from response of scrapy splash
  • I need to do a firebase stream and not a Http Get
  • Unable to compile node-runtime
  • SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'where clause'
  • How to extract only the number from a variable
  • disable linter in DAML studio
  • RxJS: How to set exhaustMap concurrent?
  • How to remove perforce (p4) on Ubuntu
  • How do they know mean and std, the input value of transforms.Normalize
  • Why this type is not an Interface?
  • SugarCRM Rest API set_relationship between Contacts and Documents
  • Jira dashboard organization
  • Web worker importScripts fails to place script variables in global scope
  • Always errors - The "path" argument must be one of type string, Buffer, or URL. Received type undefined
  • How to create an observable of a stream of infinite items
  • Not efficiently to use multi-Core CPU for training Doc2vec with gensim
  • webGL gl_Position value saving outside shaders
  • Is it okay for a resolver to have side effects besides resolving the type?
  • Move 32bit register into a 8 bit register
  • Is there a way to update, not overwrite, worker_env for a Dask YarnCluster within a script?
  • Lotus Notes Deployment
  • How Do I Add Active Directory To APIM Using Terraform?
  • How to get the old parameter values in Blazor OnParameterSet?
  • How to debug "ERROR: Could not reach the worker node."?
  • How chain indefinite amount of flatMap operators in Reactor?
  • extract dates and times from string in Redshift
  • How do I make a column of 3 cards match in height in bootstrapVue?
  • how to replace missing values from another column in PySpark?
  • only read last line of text file (C++ Builder)
  • Snakemake --forceall --dag results in mysterius Error: <stdin>: syntax error in line 1 near 'File' from Graphvis
  • How Can I Remove Demo Products From APIM Created With Terraform?
  • How to avoid cloning a big integer in rust
  • Break a row of words into word groups in Hive
  • How can I add a path variable to existing files in an Installshield project converted from MSI
  • Certain languages are not available in postman; is there a way to enable it?
  • Concatenation step of U-Net for unequal number of channels
  • HL Fabric - states, transactions but varied keys
  • How to handle "flood wait" errors when using telethon.sync?
  • Any way to make closure which takes a destructured array?
  • What is the Difference between @PeculiarVentures 's `webcrypto` and `node-webcrypto-ossl`?
  • DWG Sheet Combination failing on AutoDesk Forge
  • karate.log(args) on afterScenario hook is not embedded on surefire json file
  • How do I output latest distinct values of specific fields and all other colums?
  • Clarification on lit-element components and where to browse them
  • Will websockets over HTTP2 also be multiplexed in streams?
  • How to apply switch statement for multi columns in datatables
  • frobot framework - Usage outside testing
  • How do I build against the UCRT with mingw-w64?
  • How to use someClass.android.ts and someClass.ios.ts without errors
  • ADB Connection to Samsung smart tv
  • is there a way to 2 create multiple command files in cypress
  • Best way to filter DBpedia results and return a specific results using SPARQL
  • Is it possible to use unicode combining characters to combine arbitrary characters?
  • Antlr4 extremely simple grammar failing
  • Neighbor of 10 wrong answer?
  • PDFlib - setting stroke and fill opacity (transparency)
  • AWS Lambda + Serverless, where/how to deploy js module that couldn't be bundled?
  • how to place mobile call from PWA
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com