Giter Site home page Giter Site logo

monotouch.alalertbanner-1's Introduction

ALALertBanner iOS Binding

This is a Xamarin iOS binding for the ALAlertBanner native library.

Everyday usage

Basic code to create a basic alert banner:

using MonoTouch.ALAlertBanner;

var banner = ALAlertBanner.ALAlertBanner.AlertBannerForView(...);
banner.Show();

Native code source

Use the xamarin branch of this fork of ALAlertBanner from GitHub.

Updating the binding: no interface changes

When the ALAlertBanner library is updated but there are no changes to its public header files (in other words only the implementation code has changed), then you just need to rebuild and update the static library file included in this binding project.

Go to your working copy of the native ALAlertBanner git repository and find the directory containing Makefile. Run make clean && make all. This must be done on a Mac OS X machine with the Xcode command line tools install. See the “Requirements” and “Creating a static library” sections of the Binding Objective-C Walkthrough document.

The make command will create a new libALAlertBannerSDK.a file in the current directory. It’s a “fat binary” static library containing native code for both Intel (iOS Simulator) and ARM (iOS device) platforms. Copy this file to the MonoTouch.ALAlertBanner project directory.

Updating the binding: interface changes

When there are changes to the public header files of the ALAlertBanner library, additional steps are needed to update the generated C# code in the bindings project. These steps are based on the Binding Objective-C Walkthrough document.

“Public header files” refers to the following two files: ALAlertBanner.h and ALAlertBannerManager.h.

  1. Update libALAlertBannerSDK.a according to the instructions in the previous section
  2. Install Objective Sharpie if you have not already (see the Requirements section of the walkthrough)
  3. Run Objective Sharpie
    • Select iOS 7.0 as the Target SDK
    • Tap the [+] button under Select Header Files and choose the following two files: ALAlertBanner.h and ALAlertBannerManager.h
    • Enter MonoTouch.ALAlertBanner for the C# Namespace
    • Tap the Generate button
    • Choose a location to save the generated file. Either overwrite ApiDefinition.cs in this bindings project, or save to a temporary location and use a diff tool to merge the changes
  4. Clean up the generated code: see below
  5. Build and test using the BindingsTest project, and commit changes

Cleaning up generated code

Due to limitations of the tool, the code generated by Objective Sharpie needs some manual cleanup before it’s usable. That is why codegen is a manual step done occasionally and the generated code files are kept in source control.

Use the existing ApiDefinition.cs file as a guide, and the Binding Objective-C Walkthrough for instructions on basic cleanup tasks.

Ensure that the following is done:

  • Move enum declarations to StructsAndEnums.cs, cleaning up the bad syntax generated by the tool
  • Correct using statements (e.g. MonoTouch.ObjCRuntime, MonoTouch.Foundation, and MonoTouch.UIKit) are required
  • Comment out the overload of AlertBannerForView that takes a Delegate object (or figure out how to make it compile)
  • Remove Verify attributes. We are currently keeping array properties declared as NSObject []

monotouch.alalertbanner-1's People

Contributors

fammy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.