Crash with Swift
Hi, I get a crash as soon as I tap the tool tip:
tooltip`top_level_code at AppDelegate.swift:
0x101500540: pushq %rbp
0x101500541: movq %rsp, %rbp
0x101500544: subq $0x20, %rsp
0x101500548: callq 0x10150ac32 ; symbol stub for: Swift.C_ARGC.mutableAddressor : Swift.Int32
0x10150054d: movl (%rax), %edi
0x10150054f: movl %edi, -0x4(%rbp)
0x101500552: callq 0x10150ac38 ; symbol stub for: Swift.C_ARGV.mutableAddressor : Swift.UnsafeMutablePointer<Swift.UnsafeMutablePointer<Swift.Int8>>
0x101500557: movq (%rax), %rax
0x10150055a: movq %rax, -0x10(%rbp)
0x10150055e: callq 0x101500330 ; type metadata accessor for tooltip.AppDelegate
0x101500563: movq %rax, %rdi
0x101500566: callq 0x10150ac0e ; symbol stub for: NSStringFromClass
0x10150056b: movabsq $0x0, %rdx
0x101500575: movq -0x10(%rbp), %rdi
0x101500579: movl -0x4(%rbp), %ecx
0x10150057c: movq %rdi, -0x18(%rbp)
0x101500580: movl %ecx, %edi
0x101500582: movq -0x18(%rbp), %rsi
0x101500586: movq %rax, %rcx
0x101500589: callq 0x10150ab48 ; symbol stub for: UIApplicationMain
0x10150058e: movl %eax, -0x1c(%rbp)
0x101500591: addq $0x20, %rsp
0x101500595: popq %rbp
0x101500596: retq
The code I'm using (in a blank project with only this pod installed) is
let toolTipMgr = JDFSequentialTooltipManager(hostView: self.view)
toolTipMgr.addTooltipWithTargetView(button, hostView: self.view, tooltipText: "tip", arrowDirection: JDFTooltipViewArrowDirection.Up, width: 180.0)
toolTipMgr.showNextTooltip()
Hi @francisjervis,
The reason is that you need to keep a strong reference to the tooltip manager.
I just tried it out (in Objective-C); something like this will fix it:
// Interface
@property (nonatomic, strong) JDFSequentialTooltipManager *tooltipManager;
// somewhere else
self.tooltipManager = [[JDFSequentialTooltipManager alloc] initWithHostView:self.view];
[self.tooltipManager addTooltipWithTargetPoint:CGPointMake(100.0f, 200.0f) tooltipText:@"Tooltip" arrowDirection:JDFTooltipViewArrowDirectionUp hostView:self.view width:150.0f];
[self.tooltipManager showNextTooltip];
I should have made this clear in the README - I'll update it to say so.
Joe
Hi, this doesn’t help at all I’m afraid. This isn’t applicable for Swift as far as I know.
On Feb 21, 2015, at 6:42 AM, Joe Fryer [email protected] wrote:
Hi Francis,
The reason is that you need to keep a strong reference to the tooltip manager.
I just tried it out (in Objective-C); something like this will fix it:
// Interface @property (nonatomic, strong) JDFSequentialTooltipManager *tooltipManager;
// somewhere else self.tooltipManager = [[JDFSequentialTooltipManager alloc] initWithHostView:self.view]; [self.tooltipManager addTooltipWithTargetPoint:CGPointMake(100.0f, 200.0f) tooltipText:@"Tooltip" arrowDirection:JDFTooltipViewArrowDirectionUp hostView:self.view width:150.0f]; [self.tooltipManager showNextTooltip]; I should have made this clear in the README - I'll update it to say so.
Joe
— Reply to this email directly or view it on GitHub https://github.com/JoeFryer/JDFTooltips/issues/3#issuecomment-75368221.
So, in Swift you would add a property (let/var, whatever you want) for your tooltip manager to your view controller (I'm assuming it's a view controller where you're using the tooltips from).
Quick/dirty example, that works:

Yes, that works, thanks! Not the fix I was expecting (not sure how the “strong reference” translates to declaring as an optional then unwrapping as I don’t know ObjC).
Unfortunately tho when I add
toolTipMgr?.showsBackdropView = true
the tips don’t appear...
On Feb 21, 2015, at 12:37 PM, Joe Fryer [email protected] wrote:
So, in Swift you would add a property (let/var, whatever you want) for your tooltip manager to your view controller (I'm assuming it's a view controller where you're using the tooltips from).
Quick/dirty example, that works:
https://cloud.githubusercontent.com/assets/5180610/6315138/3d0d7a50-b9f0-11e4-9b03-b47ac279ee88.png — Reply to this email directly or view it on GitHub https://github.com/JoeFryer/JDFTooltips/issues/3#issuecomment-75382534.
You're right - I'll push a fix when I can.
As a workaround, if you show the tooltips from viewDidAppear instead of viewDidLoad/viewWillAppear, it works ok.
Thanks! I’m also seeing some odd layout behaviour (see shots)…it looks like the origin of the tip’s frame = LR corner of the target, which is unexpected with that arrow config.
On Feb 21, 2015, at 1:36 PM, Joe Fryer [email protected] wrote:
You're right - I'll push a fix when I can.
As a workaround, if you show the tooltips from viewDidAppear instead of viewDidLoad/viewWillAppear, it works ok.
— Reply to this email directly or view it on GitHub https://github.com/JoeFryer/JDFTooltips/issues/3#issuecomment-75385481.
No pictures have come through...

Hmm I've just tried something similar, and it seems to be working ok. Could you upload a test project showing the issue?