Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Features and Improvements #47

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
bcd446c
- Initial commit for bullet list
aryaxt Sep 15, 2013
194306c
- Calculating the width of the bullet string according to the font an…
aryaxt Sep 16, 2013
8641ed2
- Added ability to create bullet list by selecting multiple paragraph…
aryaxt Sep 20, 2013
bb062ca
- Detect whether bullet should be inserted or not based on the state …
aryaxt Sep 22, 2013
35c7f5a
- Fixed comment for bullet list
aryaxt Sep 22, 2013
d431626
- If initial selected range length is 0, after applying bullet place …
aryaxt Sep 22, 2013
1c61b47
- Resize toolbar and font button to display full font name
aryaxt Sep 22, 2013
c13260b
- Fixed crash when bullet is selected on empty text
aryaxt Sep 23, 2013
0f240ce
- Removed the logic that prevents existing typing attributes to be po…
aryaxt Sep 26, 2013
7cd8d1d
- Fixed a memory leak
aryaxt Sep 26, 2013
c19b17d
- Performance improvement (Don't make a copy of attributed string unl…
aryaxt Sep 26, 2013
164c203
- Workaround for the bug where in iOS6 accessing typingAttribute on a…
aryaxt Sep 30, 2013
e7c27f1
- Added TextAttachment functionality (Inserting images into RichTextE…
aryaxt Sep 30, 2013
f9582d3
Fixed #32
aryaxt Nov 4, 2013
3d536a2
- Overriding setAttributedText & setText and updating toolbar state t…
aryaxt Nov 12, 2013
5e0cd8e
- We want to update the toolbar when the font changes as well
aryaxt Nov 12, 2013
c3464c1
- Fixed the problem with the color picker where selecting outside of …
aryaxt Dec 22, 2013
7a6323d
- On iPhone (iOS7) when modal is presented, textView loses focus, whe…
aryaxt Feb 8, 2014
6fd4ad9
- Added 3 new datasource methods to allow the user to pass a custom c…
aryaxt Feb 8, 2014
eea1356
- When backspace is selected and bullet is removed, the paragraph hea…
aryaxt Feb 8, 2014
cdd5e6d
- Initial commit for bullet list
aryaxt Sep 15, 2013
ffcb8f2
- Calculating the width of the bullet string according to the font an…
aryaxt Sep 16, 2013
971de19
- Added ability to create bullet list by selecting multiple paragraph…
aryaxt Sep 20, 2013
b32a4e0
- Detect whether bullet should be inserted or not based on the state …
aryaxt Sep 22, 2013
1200ada
- Fixed comment for bullet list
aryaxt Sep 22, 2013
99fae4e
- If initial selected range length is 0, after applying bullet place …
aryaxt Sep 22, 2013
665c81f
- Resize toolbar and font button to display full font name
aryaxt Sep 22, 2013
b696dc7
- Fixed crash when bullet is selected on empty text
aryaxt Sep 23, 2013
0be0326
- Removed the logic that prevents existing typing attributes to be po…
aryaxt Sep 26, 2013
b1ff88e
- Fixed a memory leak
aryaxt Sep 26, 2013
7b5d808
- Performance improvement (Don't make a copy of attributed string unl…
aryaxt Sep 26, 2013
50f6f6e
- Workaround for the bug where in iOS6 accessing typingAttribute on a…
aryaxt Sep 30, 2013
ad985cb
- Added TextAttachment functionality (Inserting images into RichTextE…
aryaxt Sep 30, 2013
daae441
Fixed #32
aryaxt Nov 4, 2013
07fe5b0
- Overriding setAttributedText & setText and updating toolbar state t…
aryaxt Nov 12, 2013
99d13c6
- We want to update the toolbar when the font changes as well
aryaxt Nov 12, 2013
57f921e
- Fixed the problem with the color picker where selecting outside of …
aryaxt Dec 22, 2013
f27b2ac
- On iPhone (iOS7) when modal is presented, textView loses focus, whe…
aryaxt Feb 8, 2014
a7ba072
- Added 3 new datasource methods to allow the user to pass a custom c…
aryaxt Feb 8, 2014
a03f5ad
- When backspace is selected and bullet is removed, the paragraph hea…
aryaxt Feb 8, 2014
0575cad
Merge branch 'List_Implementation' of http://github.com/aryaxt/iOS-Ri…
aryaxt Apr 20, 2014
4ddd86b
Fixed some warnings
Jun 22, 2014
1158624
Fix memory bug that was releasing font before using it
cjwirth Aug 13, 2014
e98bba4
Merge pull request #49 from cjwirth/List_Implementation
aryaxt Aug 15, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions RichTextEditor.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
1583892C1735A5D7006DE713 /* MainStoryboard_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1583892A1735A5D7006DE713 /* MainStoryboard_iPhone.storyboard */; };
1583892F1735A5D7006DE713 /* MainStoryboard_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1583892D1735A5D7006DE713 /* MainStoryboard_iPad.storyboard */; };
158389321735A5D7006DE713 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 158389311735A5D7006DE713 /* ViewController.m */; };
1583893A1735A5D7006DE713 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 158389391735A5D7006DE713 /* SenTestingKit.framework */; };
1583893B1735A5D7006DE713 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 158389121735A5D7006DE713 /* UIKit.framework */; };
1583893C1735A5D7006DE713 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 158389141735A5D7006DE713 /* Foundation.framework */; };
158389441735A5D7006DE713 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 158389421735A5D7006DE713 /* InfoPlist.strings */; };
Expand Down Expand Up @@ -172,8 +171,7 @@
1583892E1735A5D7006DE713 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard_iPad.storyboard; sourceTree = "<group>"; };
158389301735A5D7006DE713 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
158389311735A5D7006DE713 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
158389381735A5D7006DE713 /* RichTextEditorTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RichTextEditorTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
158389391735A5D7006DE713 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
158389381735A5D7006DE713 /* RichTextEditorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RichTextEditorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
158389411735A5D7006DE713 /* RichTextEditorTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "RichTextEditorTests-Info.plist"; sourceTree = "<group>"; };
158389431735A5D7006DE713 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
158389451735A5D7006DE713 /* RichTextEditorTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RichTextEditorTests.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -216,6 +214,9 @@
15C4133517A48C6D0073D047 /* buttoncenter.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = buttoncenter.png; sourceTree = "<group>"; };
15C4133617A48C6D0073D047 /* buttonleft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = buttonleft.png; sourceTree = "<group>"; };
15C4133717A48C6D0073D047 /* buttonright.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = buttonright.png; sourceTree = "<group>"; };
15C9AC7818A69C69006E6F27 /* RichTextEditorColorPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RichTextEditorColorPicker.h; sourceTree = "<group>"; };
15C9AC7918A69E12006E6F27 /* RichTextEditorFontPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RichTextEditorFontPicker.h; sourceTree = "<group>"; };
15C9AC7A18A69E6E006E6F27 /* RichTextEditorFontSizePicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RichTextEditorFontSizePicker.h; sourceTree = "<group>"; };
1AFAED6E17C7F9CA00E450B0 /* strikethrough@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "strikethrough@2x.png"; sourceTree = "<group>"; };
1AFAED6F17C7F9CA00E450B0 /* italic@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "italic@2x.png"; sourceTree = "<group>"; };
1AFAED7017C7F9CA00E450B0 /* underline@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "underline@2x.png"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -247,7 +248,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1583893A1735A5D7006DE713 /* SenTestingKit.framework in Frameworks */,
1583893B1735A5D7006DE713 /* UIKit.framework in Frameworks */,
1583893C1735A5D7006DE713 /* Foundation.framework in Frameworks */,
);
Expand All @@ -268,10 +268,13 @@
153F9585179F9953005B2487 /* RichTextEditorToolbar.m */,
15B6E20D17A4C2820015867C /* RichTextEditorToggleButton.h */,
15B6E20E17A4C2820015867C /* RichTextEditorToggleButton.m */,
15C9AC7818A69C69006E6F27 /* RichTextEditorColorPicker.h */,
153F957D179F9953005B2487 /* RichTextEditorColorPickerViewController.h */,
153F957E179F9953005B2487 /* RichTextEditorColorPickerViewController.m */,
15C9AC7918A69E12006E6F27 /* RichTextEditorFontPicker.h */,
153F957F179F9953005B2487 /* RichTextEditorFontPickerViewController.h */,
153F9580179F9953005B2487 /* RichTextEditorFontPickerViewController.m */,
15C9AC7A18A69E6E006E6F27 /* RichTextEditorFontSizePicker.h */,
153F9581179F9953005B2487 /* RichTextEditorFontSizePickerViewController.h */,
153F9582179F9953005B2487 /* RichTextEditorFontSizePickerViewController.m */,
153F9583179F9953005B2487 /* RichTextEditorPopover.h */,
Expand Down Expand Up @@ -391,7 +394,7 @@
isa = PBXGroup;
children = (
1583890E1735A5D7006DE713 /* RichTextEditor.app */,
158389381735A5D7006DE713 /* RichTextEditorTests.octest */,
158389381735A5D7006DE713 /* RichTextEditorTests.xctest */,
);
name = Products;
sourceTree = "<group>";
Expand All @@ -403,7 +406,6 @@
158389121735A5D7006DE713 /* UIKit.framework */,
158389141735A5D7006DE713 /* Foundation.framework */,
158389161735A5D7006DE713 /* CoreGraphics.framework */,
158389391735A5D7006DE713 /* SenTestingKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -509,16 +511,17 @@
);
name = RichTextEditorTests;
productName = RichTextEditorTests;
productReference = 158389381735A5D7006DE713 /* RichTextEditorTests.octest */;
productType = "com.apple.product-type.bundle";
productReference = 158389381735A5D7006DE713 /* RichTextEditorTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
158389051735A5D7006DE713 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0450;
LastTestingUpgradeCheck = 0510;
LastUpgradeCheck = 0510;
ORGANIZATIONNAME = "Aryan Ghassemi";
};
buildConfigurationList = 158389081735A5D7006DE713 /* Build configuration list for PBXProject "RichTextEditor" */;
Expand Down Expand Up @@ -743,6 +746,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down Expand Up @@ -800,13 +804,13 @@
FRAMEWORK_SEARCH_PATHS = (
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RichTextEditor/RichTextEditor-Prefix.pch";
INFOPLIST_FILE = "RichTextEditorTests/RichTextEditorTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = octest;
};
name = Debug;
};
Expand All @@ -817,13 +821,13 @@
FRAMEWORK_SEARCH_PATHS = (
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RichTextEditor/RichTextEditor-Prefix.pch";
INFOPLIST_FILE = "RichTextEditorTests/RichTextEditorTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = octest;
};
name = Release;
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>5094D3CF-B317-41F7-9AA1-801D09780AE3</string>
<key>IDESourceControlProjectName</key>
<string>RichTextEditor</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>D9C29B00-DAC9-49D9-839A-1500CC1E9C1A</key>
<string>http://github.com/aryaxt/iOS-Rich-Text-Editor.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>RichTextEditor.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>D9C29B00-DAC9-49D9-839A-1500CC1E9C1A</key>
<string>../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>http://github.com/aryaxt/iOS-Rich-Text-Editor.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>D9C29B00-DAC9-49D9-839A-1500CC1E9C1A</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>D9C29B00-DAC9-49D9-839A-1500CC1E9C1A</string>
<key>IDESourceControlWCCName</key>
<string>iOS-Rich-Text-Editor</string>
</dict>
</array>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges</key>
<true/>
<key>SnapshotAutomaticallyBeforeSignificantChanges</key>
<false/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "1.0">
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "RichTextEditor/Source/RichTextEditor.m"
timestampString = "413573789.248834"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "608"
endingLineNumber = "608"
landmarkName = "@implementation RichTextEditor"
landmarkType = "3">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1583890D1735A5D7006DE713"
BuildableName = "RichTextEditor.app"
BlueprintName = "RichTextEditor"
ReferencedContainer = "container:RichTextEditor.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "158389371735A5D7006DE713"
BuildableName = "RichTextEditorTests.octest"
BlueprintName = "RichTextEditorTests"
ReferencedContainer = "container:RichTextEditor.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1583890D1735A5D7006DE713"
BuildableName = "RichTextEditor.app"
BlueprintName = "RichTextEditor"
ReferencedContainer = "container:RichTextEditor.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1583890D1735A5D7006DE713"
BuildableName = "RichTextEditor.app"
BlueprintName = "RichTextEditor"
ReferencedContainer = "container:RichTextEditor.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1583890D1735A5D7006DE713"
BuildableName = "RichTextEditor.app"
BlueprintName = "RichTextEditor"
ReferencedContainer = "container:RichTextEditor.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>RichTextEditor.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>1583890D1735A5D7006DE713</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>158389371735A5D7006DE713</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
Binary file added RichTextEditor/Source/Assets/colorsOld.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ @implementation NSAttributedString (RichTextEditor)

- (NSRange)firstParagraphRangeFromTextRange:(NSRange)range
{
if (self.string.length == 0)
return NSMakeRange(0, 0);

NSInteger start = -1;
NSInteger end = -1;
NSInteger length = 0;
Expand All @@ -41,7 +44,7 @@ - (NSRange)firstParagraphRangeFromTextRange:(NSRange)range
range.location-1 :
range.location;

for (int i=startingRange ; i>=0 ; i--)
for (NSInteger i=startingRange ; i>=0 ; i--)
{
char c = [self.string characterAtIndex:i];
if (c == '\n')
Expand All @@ -55,7 +58,7 @@ - (NSRange)firstParagraphRangeFromTextRange:(NSRange)range

NSInteger moveForwardIndex = (range.location > start) ? range.location : start;

for (int i=moveForwardIndex; i<= self.string.length-1 ; i++)
for (NSInteger i=moveForwardIndex; i<= self.string.length-1 ; i++)
{
char c = [self.string characterAtIndex:i];
if (c == '\n')
Expand Down
7 changes: 6 additions & 1 deletion RichTextEditor/Source/Categories/UIFont+RichTextEditor.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,15 @@ + (UIFont *)fontWithName:(NSString *)name size:(CGFloat)size boldTrait:(BOOL)isB
newFontRef = CTFontCreateCopyWithSymbolicTraits(fontWithoutTrait, 0.0, NULL, traits, traits);
}

if (fontWithoutTrait)
CFRelease(fontWithoutTrait);

if (newFontRef)
{
NSString *fontNameKey = (__bridge NSString *)(CTFontCopyName(newFontRef, kCTFontPostScriptNameKey));
return [UIFont fontWithName:fontNameKey size:CTFontGetSize(newFontRef)];
CGFloat size = CTFontGetSize(newFontRef);
CFRelease(newFontRef);
return [UIFont fontWithName:fontNameKey size:size];
}

return nil;
Expand Down
Loading