Skip to content

Instantly share code, notes, and snippets.

View Axemasta's full-sized avatar

Axemasta

View GitHub Profile
@Axemasta
Axemasta / ButtonOverScrollView.xaml
Last active February 2, 2018 16:46
XAML Code that demonstrates how you can add a button over a scroll view for a Xamarin app
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:ScrollViewFormatting"
x:Class="ScrollViewFormatting.ScrollViewFormattingPage">
<ContentPage.Padding>
<OnPlatform x:TypeArguments="Thickness">
<OnPlatform.iOS>0,20,0,0</OnPlatform.iOS>
</OnPlatform>
@Axemasta
Axemasta / ButtonOverScrollView.xaml.cs
Last active February 5, 2018 10:23
C# Code that demonstrates how you can add a button over a scroll view for a Xamarin app
using Xamarin.Forms;
using System;
namespace ScrollViewFormatting
{
public partial class ScrollViewFormattingPage : ContentPage
{
public ScrollViewFormattingPage()
{
//Create button
MGSwipeButton *swipeButton = MGSwipeButton buttonWithTitle:@"Title" icon:[UIImage imageNamed:@"your_image"] backgroundColor:[UIColor clearColor];
//Create view (to use as a mask)
CGFloat cellHeight = 90; //return your tableview cell height here
CGRect buttonFrame = CGRectMake(0, 0, cellHeight, cellHeight);
UIView *swipeButtonView = [[UIView alloc] initWithFrame:buttonFrame];
//Create gradient layer (I'm using a custom method to do this)
//This methods creates a gradient layer and adds it to my swipe button