GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing alexhedley.wordpress.com — Alex Hedley
Alex Hedley
The ramblings of a madmanSymantec Connect – 100 SolutionsAfter 6 years and 23 weeks I’ve hit 100 solutions from 1,028 comments. Not sure if that’s a good ratio in comparison to others but it is a milestone I thought I’d document. You can find my profile here: https://www.symantec.com/connect/user/alexhedley
I’ve made a lot of Articles over the years, mostly for Symantec Workflow / ServiceDesk / SMP. Let’s see when I hit 200!
JSQMessagesViewController – Messages UIOn the app I’m currently working on I’ve got a messaging portion. Originally I implemented a basic TableView with a TextField to add a message. Then I searched for Messages UI frameworks and came across JSQMessagesViewController
There’s a Sample project you can look into – JSQMessagesDemo. It comes as a Cocoapod: I’m using 7.3.4. Create a new Xcode project. Open terminal at that folder pod init add pod 'JSQMessagesViewController'
then pod install Open the Xcode ‘#App.xcworkspace’ Create a View Controller that inherits : JSQMessagesViewController<UIActionSheetDelegate, JSQMessagesComposerTextViewPasteDelegate> #import <JSQMessagesViewController/JSQMessagesViewController.h> #import "DemoData.h" @class MessageViewController; @protocol MessageViewControllerDelegate <NSObject> - (void)didDismissMessagesViewController:(MessageViewController *)vc; @end Add some properties and methods @property (weak, nonatomic) id<MessageViewControllerDelegate> delegateModal; @property (strong, nonatomic) DemoData *data; - (void)receiveMessagePressed:(UIBarButtonItem *)sender; - (void)closePressed:(UIBarButtonItem *)sender; I didn’t bother with any of the settings so commented these checks out. I couldn’t find the Accessory Button Delegate to add to my View Controller. #import "JSQMessagesViewAccessoryButtonDelegate.h" <JSQMessagesViewAccessoryButtonDelegate> For testing create a new class for your demo data. DemoData.h @interface DemoData : NSObject @property (strong, nonatomic) NSMutableArray *messages; @property (strong, nonatomic) NSDictionary *users; @property (strong, nonatomic) JSQMessagesBubbleImage *outgoingBubbleImageData; @property (strong, nonatomic) JSQMessagesBubbleImage *incomingBubbleImageData; @end
DemoData.m Create some test Users. - (instancetype)init {
self = [super init]; if (self) {
[self loadFakeMessages]; self.users = @{ @"1" : @"Alex",
@"2" : @"Sam", @"3" : @"Kev", @"4" : @"Ray" }; JSQMessagesBubbleImageFactory *bubbleFactory = [[JSQMessagesBubbleImageFactory alloc] init]; self.outgoingBubbleImageData = [bubbleFactory outgoingMessagesBubbleImageWithColor:[UIColor jsq_messageBubbleLightGrayColor]]; self.incomingBubbleImageData = [bubbleFactory incomingMessagesBubbleImageWithColor:[UIColor jsq_messageBubbleGreenColor]]; } return self; } Create the Fake Messages - (void)loadFakeMessages { ... }
We can use this back in our MessageViewController.m #pragma mark - View lifecycle
Since I’m not using Avatars add this to viewDidLoad self.collectionView.collectionViewLayout.incomingAvatarViewSize = CGSizeZero; self.collectionView.collectionViewLayout.outgoingAvatarViewSize = CGSizeZero; Also return nil in ‘avatarImageDataForItemAtIndexPath’ - (id<JSQMessageAvatarImageDataSource>)collectionView:(JSQMessagesCollectionView *)collectionView avatarImageDataForItemAtIndexPath:(NSIndexPath *)indexPath {
... return nil; } Implement these other methods. #pragma mark - Custom menu actions for cells #pragma mark - Actions #pragma mark - JSQMessagesViewController method overrides #pragma mark - JSQMessages CollectionView DataSource Choose a user here
#pragma mark - UICollectionView DataSource #pragma mark - UICollectionView Delegate #pragma mark - Custom menu items #pragma mark - JSQMessages collection view flow layout delegate #pragma mark - Adjusting cell label heights #pragma mark - Responding to collection view tap events #pragma mark - JSQMessagesComposerTextViewPasteDelegate methods #pragma mark - JSQMessagesViewAccessoryDelegate methods Changing some settings I didn’t want the Add Attachments button. viewDidLoad self.inputToolbar.contentView.leftBarButtonItem = nil;
Now just to swap out the messages to my XMPP Server…
XMPPFrameworkXMPPFramework Create an Xcode project. Open terminal at that folder location. pod init pod 'XMPPFramework', :git => "https://github.com/robbiehanson/XMPPFramework.git", :branch => 'master'
Getting Started Tutorials
Had issues setting up Ejabbered on the mac. I’m using an OpenFire server I setup so used that instead, with a couple of clients connected to there instead. Clients Stack Overflow Setting the Server set the server url set the port Delivery Receipts Read Receipts Group Chat
MapKitSo I’ve been learning MapKit this week. It’s been a fun new framework to look into. Create an Annotation so you can have custom properties. @interface Annotation : NSObject<MKAnnotation> Add a category to it so you have a way of telling what it is. This could be an enum. In the Delegate method - (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation You can use the category to set up some properties like a button and the pin colour. I’m wondering if the “reuseIdentifier” should be unique here too? You’ve added a button, now how to call it? You could add a target and action [rightButton addTarget:## action:## forControlEvents:UIControlEventTouchUpInside]; but instead you can use the “calloutAccessoryControlTapped” delegate method. - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control As this isn’t a “MKAnnotation” like “viewForAnnotation” but an “MKAnnotationView” we need to get the annotation from the passed view. if ([view.annotation isKindOfClass:[OotAnnotation class]]) { ... }
Then call pfs, Then in the “prepareForSegue” you need to get the Annotation when you click on a Pin button, this can be cast from the Sender if ([view.annotation isKindOfClass:[OotAnnotation class]]) { ... }
Annotation *annotation = (Annotation *)[(MKAnnotationView *)sender annotation]; You could then pass your custom Location details via the ViewController. (See code) — Searching for locations to add to the map: MKLocalSearchRequest — Adding a route, need to investigate this more. MKPolyline — All Code
Goals for 2018Xamarin I’d started some training last year but didn’t make any useful apps, I’d like to progress this to a production one in 2018. .NET I’d like to make progress in either or both of my Tracking app ideas. 599CD Actually release it, I’ve been holding off hoping the API will be re-written, maybe I should just release, then update when it is. Although releasing the Android at the same time would be nice. Certs MS: Programming in HTML5 with JavaScript and CSS3 MCSA: Web Applications MCPS: Developing ASP.NET MVC Web Applications Microsoft Certified Solution Developer: App Builder
Goals for 2017 – Review599CD
Still waiting on Rich to make a proper API. Jam Jar Worked with PassSlot and have a local iOS app that creates them, with images .NET Apps I worked a little on a GNVQ tracking app for Learning Objectives, the back end is mostly there, still working on the UI. In general I was working on a major iOS project at work so didn’t have a massive amount of spare time, learned lots of new APIs and techniques in ObjC and iOS dev which was great. Previous
UIBarButtonItem Image and TextI want to add an image and text to a BarButtonItem but can’t in IB.
I looked into EdgeInsets but couldn’t get them to work with the image.
I’d also like to shrink the image // https://stackoverflow.com/a/18853240/2895831 UIView *rightButtonView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 110, 50)]; UIImage *buttonImage = [UIImage imageNamed:@"LocationArrow"]; //UIEdgeInsets edgeInsets = UIEdgeInsetsMake(50, 50, 50, 50); //UIImage *buttonImage = [[UIImage imageNamed:@"LocationArrow"] resizableImageWithCapInsets:edgeInsets]; //UIImage(CGImage: originalImage!.CGImage!, scale: 5, orientation: originalImage!.imageOrientation) // https://stackoverflow.com/a/38523085/2895831 buttonImage = [UIImage imageWithCGImage:buttonImage.CGImage scale:4//CGImageGetHeight(buttonImage.CGImage)/2 orientation:UIImageOrientationUp]; UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeSystem]; rightButton.backgroundColor = [UIColor clearColor]; rightButton.frame = rightButtonView.frame; [rightButton setImage:buttonImage forState:UIControlStateNormal]; [rightButton setTitle:NSLocalizedString(@"My Location", nil) forState:UIControlStateNormal]; rightButton.tintColor = [UIColor whiteColor]; rightButton.autoresizesSubviews = YES; rightButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin; rightButton.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft; [rightButton addTarget:self action:@selector(myLocationAction:) forControlEvents:UIControlEventTouchUpInside]; CGFloat padding = 10.0f; [rightButton setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 0, padding)]; //[rightButton setContentEdgeInsets:UIEdgeInsetsMake(0, 0, 0, padding)]; //[rightButton setContentEdgeInsets:UIEdgeInsetsMake(padding, padding, padding, padding)]; //[rightButton setImageEdgeInsets:UIEdgeInsetsMake(padding, 0, padding, 0)]; //0, padding, 0, padding //[rightButton setImageEdgeInsets:UIEdgeInsetsMake(padding, padding, padding, padding)]; [rightButtonView addSubview:rightButton]; UIBarButtonItem *rightBarButton = [[UIBarButtonItem alloc] initWithCustomView:rightButtonView]; self.navigationItem.rightBarButtonItem = rightBarButton;
Image [UIImage imageWithCGImage:buttonImage.CGImage scale:4 orientation:UIImageOrientationUp]; Pick your method to scale CGImageGetHeight(buttonImage.CGImage)/2 Or CGImageGetWidth(...)/DESIREDWIDTH
IB There is the handy Bar Item Image Inset
UIButton VerticalLayouthttps://stackoverflow.com/a/22621613/2895831
I added some buttons into a UIStackView but the image overlaps the button. I modified the contentEdgeInsets CGFloat inset = (self.frame.size.height - totalHeight)/2; self.contentEdgeInsets = UIEdgeInsetsMake(inset, 0.0f, inset, 0.0f);
Pollen Today WidgetI want a today Widget to show pollen count. I downloaded: Clarityn’s Pollen Forecast UK by Bayer HealthCare AG They have a website http://www.claritynallergy.co.uk/allergyforecast/?zip=X It doesn’t have the Widget I wanted so I started looking for an API. POST http://www.claritynallergy.co.uk/webservice/allergyforecast.php Header Accept: application/json Body Form URL-Encoded zip=NE11EE Response "{\"Durham & Newcastle\":{\"1499515201\":{\"precipitation\":8,\"maxTemp\":21,\"minTemp\":16,\"pollenLevel\":\"H\",\"humidity\":83,\"windSpeed\":7,\"weatherCode\":7,\"uvIndex\":5,\"pollenType\":\"Grass\"},\"1499601600\":{\"precipitation\":18,\"maxTemp\":18,\"minTemp\":15,\"pollenLevel\":\"H\",\"humidity\":80,\"windSpeed\":18,\"weatherCode\":7,\"uvIndex\":4,\"pollenType\":\"Grass\"},\"1499688000\":{\"precipitation\":23,\"maxTemp\":18,\"minTemp\":14,\"pollenLevel\":\"M\",\"humidity\":69,\"windSpeed\":11,\"weatherCode\":3,\"uvIndex\":7,\"pollenType\":\"Grass\"}}}"
Images “http://www.claritynallergy.co.uk/static/media/images/claritynallergy/7-trans.png” : I found Benadryl has one. https://www.benadryl.co.uk/social-pollen-count GET https://socialpollencount.co.uk/api/forecast?location=%5BLAT,LON] Response {"status_code":"200 OK","date":"2017-07-02T07:13:47+00:00","forecast":[{"date":"2017-06-29T08:00:01+00:00","pollen_count":"Low"},{"date":"2017-06-30T08:00:01+00:00","pollen_count":"Low"},{"date":"2017-07-01T08:00:01+00:00","pollen_count":"High"},{"date":"2017-07-02T08:00:01+00:00","pollen_count":"High","temperature":"18","weather_code":"01","weather":"Sunny"},{"date":"2017-07-03T08:00:01+00:00","pollen_count":"High","temperature":"18","weather_code":"07","weather":"Medium-level cloud"},{"date":"2017-07-04T08:00:01+00:00","pollen_count":"Moderate","temperature":"14","weather_code":"12","weather":"Light rain"}]}
Images “https://socialpollencount.co.uk/images/content/weather/07.pnp” : App: https://itunes.apple.com/gb/app/benadryl-social-pollen-count/id638068252?mt=8 App doesn’t exist. Progress
Carousel ViewiCarousel I wanted to add an animation when dismissing, a button at the top and bottom of the view, one to dismiss, one to save, and move off in that direction.
MDCSwipeToChoose TinderSimpleSwipeCards @clsource added other directions Directions
About MeI'm a Web and App Developer.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |